Skip to content

Commit

Permalink
Thinning out fluid.cxx
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasWM committed Nov 15, 2024
1 parent e0f0fe2 commit 4813b0b
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 412 deletions.
9 changes: 0 additions & 9 deletions fluid/Fd_Snap_Action.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ Fd_Layout_List g_layout_list;

// ---- Callbacks ------------------------------------------------------ MARK: -

void layout_suite_marker(Fl_Widget *, void *) {
// intentionally left empty
}

void select_layout_suite_cb(Fl_Widget *, void *user_data) {
int index = (int)(fl_intptr_t)user_data;
assert(index >= 0);
Expand All @@ -131,11 +127,6 @@ void select_layout_suite_cb(Fl_Widget *, void *user_data) {
g_layout_list.update_dialogs();
}

void select_layout_preset_cb(Fl_Widget *, void *user_data) {
int index = (int)(fl_intptr_t)user_data;
select_layout_preset(index);
}

void select_layout_preset(int index) {
assert(index >= 0);
assert(index < 3);
Expand Down
5 changes: 3 additions & 2 deletions fluid/Fl_Function_Type.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "fluid.h"
#include "application/application.h"
#include "project/project.h"
#include "ui/main_panel.h"
#include "Fl_Window_Type.h"
#include "Fl_Group_Type.h"
#include "widget_browser.h"
Expand Down Expand Up @@ -668,7 +669,7 @@ void Fl_Code_Type::open() {
void Fl_Code_Type::write(fluid::stream::ProjectWriter &f) {
// External editor changes? If so, load changes into ram, update mtime/size
if ( handle_editor_changes() == 1 ) {
main_window->redraw(); // tell fluid to redraw; edits may affect tree's contents
fluid::ui::main_panel.main_window->redraw(); // tell fluid to redraw; edits may affect tree's contents
}
Fl_Type::write(f);
}
Expand All @@ -679,7 +680,7 @@ void Fl_Code_Type::write(fluid::stream::ProjectWriter &f) {
void Fl_Code_Type::write_code1(fluid::stream::CodeWriter& f) {
// External editor changes? If so, load changes into ram, update mtime/size
if ( handle_editor_changes() == 1 ) {
main_window->redraw(); // tell fluid to redraw; edits may affect tree's contents
fluid::ui::main_panel.main_window->redraw(); // tell fluid to redraw; edits may affect tree's contents
}
f.tag(FD_TAG_GENERIC, 0);
f.write_c_indented(name(), 0, '\n');
Expand Down
13 changes: 4 additions & 9 deletions fluid/Fl_Window_Type.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ void Overlay_Window::draw() {
}
}

extern Fl_Window *main_window;

// Read an image of the overlay window
// TODO: is this actually called from anywhere?
uchar *Overlay_Window::read_image(int &ww, int &hh) {
Expand Down Expand Up @@ -219,7 +217,7 @@ uchar *Overlay_Window::read_image(int &ww, int &hh) {

// Cleanup and return...
fl_delete_offscreen(offscreen);
main_window->make_current();
fluid::ui::main_panel.main_window->make_current();
return pixels;
}

Expand Down Expand Up @@ -346,9 +344,9 @@ uchar *Fl_Window_Type::read_image(int &ww, int &hh) {

void Fl_Window_Type::ideal_size(int &w, int &h) {
w = 480; h = 320;
if (main_window) {
if (fluid::ui::main_panel.main_window) {
int sx, sy, sw, sh;
Fl_Window *win = main_window;
Fl_Window *win = fluid::ui::main_panel.main_window;
int screen = Fl::screen_num(win->x(), win->y());
Fl::screen_work_area(sx, sy, sw, sh, screen);
w = std::min(w, sw*3/4); h = std::min(h, sh*3/4);
Expand Down Expand Up @@ -727,8 +725,6 @@ void Fl_Window_Type::draw_overlay() {
}
}

extern Fl_Menu_Item Main_Menu[];

// Calculate new bounding box of selected widgets:
void Fl_Window_Type::fix_overlay() {
fluid::ui::main_panel.overlay_item->label("Hide O&verlays");
Expand Down Expand Up @@ -880,7 +876,6 @@ extern void deselect();
extern Fl_Type* in_this_only;
extern void fix_group_size(Fl_Type *t);

extern Fl_Menu_Item Main_Menu[];
extern Fl_Menu_Item New_Menu[];

/**
Expand Down Expand Up @@ -1270,7 +1265,7 @@ int Fl_Window_Type::handle(int event) {

case FL_SHORTCUT: {
in_this_only = this; // modifies how some menu items work.
const Fl_Menu_Item* m = Main_Menu->test_shortcut();
const Fl_Menu_Item* m = fluid::ui::main_panel.main_menubar->test_shortcut();
if (m && m->callback()) m->do_callback(this->o);
in_this_only = 0;
return (m != 0);}
Expand Down
1 change: 0 additions & 1 deletion fluid/align_widget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

void align_widget_cb(Fl_Widget*, void *how_ptr)
{
Fluid.project.undo.checkpoint();
const int max = 32768, min = -32768;
int left, right, top, bot, wdt, hgt, n;
Fl_Type *o;
Expand Down
7 changes: 4 additions & 3 deletions fluid/autodoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "fluid.h"
#include "application/application.h"
#include "project/project.h"
#include "ui/main_panel.h"
#include "factory.h"
#include "widget_browser.h"
#include "widget_panel.h"
Expand Down Expand Up @@ -416,9 +417,9 @@ void run_autodoc(const Fl_String &target_dir) {
// explain menubar?
// explain widget browser
// explain widget browser entry
main_window->size(350, 320);
fl_snapshot((target_dir + "main_window.png").c_str(), main_window, win_margin, win_blend);
fl_snapshot((target_dir + "main_menubar.png").c_str(), main_menubar, row_margin, row_blend);
fluid::ui::main_panel.main_window->size(350, 320);
fl_snapshot((target_dir + "main_window.png").c_str(), fluid::ui::main_panel.main_window, win_margin, win_blend);
fl_snapshot((target_dir + "main_menubar.png").c_str(), fluid::ui::main_panel.main_menubar, row_margin, row_blend);
fl_snapshot((target_dir + "main_browser.png").c_str(), widget_browser, FL_SNAP_AREA_CLEAR,
Fl_Rect(0, 30, FL_SNAP_TO_WINDOW, 100), row_blend, 2.0);

Expand Down
5 changes: 3 additions & 2 deletions fluid/factory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "fluid.h"
#include "application/application.h"
#include "project/project.h"
#include "ui/main_panel.h"
#include "Fl_Group_Type.h"
#include "Fl_Grid_Type.h"
#include "Fl_Menu_Type.h"
Expand Down Expand Up @@ -1303,9 +1304,9 @@ Fl_Type *add_new_widget_from_user(Fl_Type *inPrototype, Strategy strategy, bool
int x = 0, y = 0, w = 480, h = 320;
Fl_Window_Type *wt = (Fl_Window_Type *)t;
wt->ideal_size(w, h);
if (main_window) {
if (fluid::ui::main_panel.main_window) {
int sx, sy, sw, sh;
Fl_Window *win = main_window;
Fl_Window *win = fluid::ui::main_panel.main_window;
int screen = Fl::screen_num(win->x(), win->y());
Fl::screen_work_area(sx, sy, sw, sh, screen);
x = sx + sw/2 - w/2;
Expand Down
Loading

0 comments on commit 4813b0b

Please sign in to comment.