Skip to content

Commit

Permalink
Update dependencies, whitespace, and Fl_File_Chooser.cxx
Browse files Browse the repository at this point in the history
Rewrite src/Fl_File_Chooser.cxx from its .fl source file
  • Loading branch information
Albrecht Schlosser committed Mar 19, 2024
1 parent 3a8daf7 commit af90841
Show file tree
Hide file tree
Showing 18 changed files with 116 additions and 22 deletions.
2 changes: 1 addition & 1 deletion FL/Fl_Shared_Image.H
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public:
#ifdef SHIM_DEBUG
static void print_pool();
#endif

/** Returns the filename of the shared image */
const char *name() { return name_; }

Expand Down
1 change: 1 addition & 0 deletions fltk-options/makedepend
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ fltk-options.o: ../FL/Fl_RGB_Image.H
fltk-options.o: ../FL/Fl_Scroll.H
fltk-options.o: ../FL/Fl_Scrollbar.H
fltk-options.o: ../FL/Fl_Slider.H
fltk-options.o: ../FL/fl_string_functions.h
fltk-options.o: ../FL/Fl_Tooltip.H
fltk-options.o: ../FL/fl_types.h
fltk-options.o: ../FL/fl_utf8.h
Expand Down
2 changes: 1 addition & 1 deletion fluid/Fl_Menu_Type.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ void Fl_Menu_Item_Type::write_code1(Fd_Code_Writer& f) {
f.indent(), g_project.i18n_gnu_function.c_str());
} else if (g_project.i18n_type==FD_I18N_POSIX) {
f.write_c("%sml->labelb = catgets(%s,%s,i+%d,o->label());\n",
f.indent(),
f.indent(),
g_project.i18n_pos_file.empty() ? "_catalog" : g_project.i18n_pos_file.c_str(),
g_project.i18n_pos_set.c_str(), msgnum());
}
Expand Down
4 changes: 2 additions & 2 deletions fluid/Fl_Widget_Type.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3006,7 +3006,7 @@ void Fl_Widget_Type::write_code1(Fd_Code_Writer& f) {
f.write_c(")");
break;
case FD_I18N_POSIX : /* POSIX catgets */
f.write_c("catgets(%s,%s,%d,",
f.write_c("catgets(%s,%s,%d,",
g_project.i18n_pos_file.empty() ? "_catalog" : g_project.i18n_pos_file.c_str(),
g_project.i18n_pos_set.c_str(), msgnum());
f.write_cstring(label());
Expand Down Expand Up @@ -3082,7 +3082,7 @@ void Fl_Widget_Type::write_widget_code(Fd_Code_Writer& f) {
case FD_I18N_POSIX : /* POSIX catgets */
f.write_c("catgets(%s,%s,%d,",
g_project.i18n_pos_file.empty() ? "_catalog" : g_project.i18n_pos_file.c_str(),
g_project.i18n_pos_set.c_str(),
g_project.i18n_pos_set.c_str(),
msgnum() + 1);
f.write_cstring(tooltip());
f.write_c(")");
Expand Down
4 changes: 2 additions & 2 deletions fluid/fluid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ static Fl_String end_with_slash(const Fl_String &str) {
return str;
}

/**
/**
Generate a path to a directory for temporary data storage.
The path is stored in g_tmpdir.
*/
Expand Down Expand Up @@ -345,7 +345,7 @@ static void create_tmpdir() {
}
}

/**
/**
Delete the temporary directory that was created in set_tmpdir.
*/
static void delete_tmpdir() {
Expand Down
8 changes: 8 additions & 0 deletions fluid/makedepend
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ about_panel.o: ../FL/Fl_Group.H
about_panel.o: ../FL/Fl_Image.H
about_panel.o: ../FL/Fl_Pixmap.H
about_panel.o: ../FL/Fl_Return_Button.H
about_panel.o: ../FL/fl_string_functions.h
about_panel.o: ../FL/fl_types.h
about_panel.o: ../FL/fl_utf8.h
about_panel.o: ../FL/Fl_Widget.H
Expand Down Expand Up @@ -371,6 +372,7 @@ factory.o: ../FL/Fl_Roller.H
factory.o: ../FL/Fl_Scrollbar.H
factory.o: ../FL/Fl_Slider.H
factory.o: ../FL/Fl_Spinner.H
factory.o: ../FL/fl_string_functions.h
factory.o: ../FL/Fl_Tabs.H
factory.o: ../FL/Fl_Terminal.H
factory.o: ../FL/Fl_Text_Buffer.H
Expand Down Expand Up @@ -919,6 +921,7 @@ Fl_Grid_Type.o: ../FL/Fl_Rect.H
Fl_Grid_Type.o: ../FL/Fl_RGB_Image.H
Fl_Grid_Type.o: ../FL/Fl_Scrollbar.H
Fl_Grid_Type.o: ../FL/Fl_Slider.H
Fl_Grid_Type.o: ../FL/fl_string_functions.h
Fl_Grid_Type.o: ../FL/Fl_Tabs.H
Fl_Grid_Type.o: ../FL/fl_types.h
Fl_Grid_Type.o: ../FL/fl_utf8.h
Expand Down Expand Up @@ -972,6 +975,7 @@ Fl_Group_Type.o: ../FL/Fl_RGB_Image.H
Fl_Group_Type.o: ../FL/Fl_Scroll.H
Fl_Group_Type.o: ../FL/Fl_Scrollbar.H
Fl_Group_Type.o: ../FL/Fl_Slider.H
Fl_Group_Type.o: ../FL/fl_string_functions.h
Fl_Group_Type.o: ../FL/Fl_Table.H
Fl_Group_Type.o: ../FL/Fl_Tabs.H
Fl_Group_Type.o: ../FL/fl_types.h
Expand Down Expand Up @@ -1032,6 +1036,7 @@ Fl_Menu_Type.o: ../FL/Fl_Scrollbar.H
Fl_Menu_Type.o: ../FL/Fl_Shared_Image.H
Fl_Menu_Type.o: ../FL/Fl_Shortcut_Button.H
Fl_Menu_Type.o: ../FL/Fl_Slider.H
Fl_Menu_Type.o: ../FL/fl_string_functions.h
Fl_Menu_Type.o: ../FL/Fl_Tabs.H
Fl_Menu_Type.o: ../FL/Fl_Text_Buffer.H
Fl_Menu_Type.o: ../FL/Fl_Text_Display.H
Expand Down Expand Up @@ -1088,6 +1093,7 @@ Fl_Type.o: ../FL/Fl_RGB_Image.H
Fl_Type.o: ../FL/Fl_Scrollbar.H
Fl_Type.o: ../FL/Fl_Shared_Image.H
Fl_Type.o: ../FL/Fl_Slider.H
Fl_Type.o: ../FL/fl_string_functions.h
Fl_Type.o: ../FL/Fl_Tabs.H
Fl_Type.o: ../FL/fl_types.h
Fl_Type.o: ../FL/fl_utf8.h
Expand Down Expand Up @@ -1563,6 +1569,7 @@ sourceview_panel.o: ../FL/Fl_Rect.H
sourceview_panel.o: ../FL/Fl_RGB_Image.H
sourceview_panel.o: ../FL/Fl_Scrollbar.H
sourceview_panel.o: ../FL/Fl_Slider.H
sourceview_panel.o: ../FL/fl_string_functions.h
sourceview_panel.o: ../FL/Fl_Tabs.H
sourceview_panel.o: ../FL/Fl_Text_Buffer.H
sourceview_panel.o: ../FL/Fl_Text_Display.H
Expand Down Expand Up @@ -1646,6 +1653,7 @@ undo.o: ../FL/Fl_Rect.H
undo.o: ../FL/Fl_RGB_Image.H
undo.o: ../FL/Fl_Scrollbar.H
undo.o: ../FL/Fl_Slider.H
undo.o: ../FL/fl_string_functions.h
undo.o: ../FL/fl_types.h
undo.o: ../FL/fl_utf8.h
undo.o: ../FL/Fl_Valuator.H
Expand Down
4 changes: 2 additions & 2 deletions src/Fl_Button.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ int Fl_Button::handle(int event) {
set_changed();
if (when() & FL_WHEN_CHANGED)
do_callback(FL_REASON_CHANGED);
else if (when() & FL_WHEN_RELEASE)
else if (when() & FL_WHEN_RELEASE)
do_callback(FL_REASON_RELEASED);
} else {
if (when() & FL_WHEN_NOT_CHANGED)
if (when() & FL_WHEN_NOT_CHANGED)
do_callback(FL_REASON_SELECTED);
}
} else if (type() == FL_TOGGLE_BUTTON) {
Expand Down
2 changes: 1 addition & 1 deletion src/Fl_File_Chooser.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *pathname, const char *pattern, int
{ Fl_Group* o = new Fl_Group(10, 275, 470, 95);
{ Fl_Group* o = new Fl_Group(10, 275, 470, 20);
{ previewButton = new Fl_Check_Button(10, 275, 105, 20, "Preview");
previewButton->shortcut(0x80070);
previewButton->shortcut(FL_ALT|'p');
previewButton->down_box(FL_DOWN_BOX);
previewButton->value(1);
previewButton->callback((Fl_Callback*)cb_previewButton);
Expand Down
2 changes: 1 addition & 1 deletion src/Fl_MacOS_Sys_Menu_Bar.mm
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ static void merge_all_windows_cb(Fl_Widget *, void *)
int index = window_menu_items->size() - 1;
if (index >= window_menu_items_count - 1) {
window_menu_items_count += 5;
window_menu_items = (Fl_Menu_Item*)realloc(window_menu_items,
window_menu_items = (Fl_Menu_Item*)realloc(window_menu_items,
window_menu_items_count * sizeof(Fl_Menu_Item));
Fl_Menu_Item *item = (Fl_Menu_Item*)fl_sys_menu_bar->find_item("Window");
item->user_data(window_menu_items);
Expand Down
4 changes: 2 additions & 2 deletions src/Fl_Shared_Image.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extern "C" {
}


/**
/**
Returns the Fl_Shared_Image* array.
\return a pointer to an array of shared image pointers, sorted by name and size
Expand Down Expand Up @@ -402,7 +402,7 @@ Fl_Image *Fl_Shared_Image::copy() const {
/**
Averages the colors in the image with the provided FLTK color value.
This method changes the pixel data of this specific image.
This method changes the pixel data of this specific image.
\note It does not change any of the resized copies of this image, nor does it
necessarily apply the color changes if this image is resized later.
Expand Down
2 changes: 1 addition & 1 deletion src/Fl_x.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ int fl_handle(const XEvent& thisevent)
XEvent xevent = thisevent;
fl_xevent = &thisevent;
Window xid = xevent.xany.window;

// For each DestroyNotify event, determine whether an FLTK-created window
// is being destroyed (see issue #935).
bool xid_is_from_fltk_win = false;
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ void Fl_Wayland_Gl_Window_Driver::resize(int is_a_resize, int W, int H) {
struct wld_window *xid = fl_wl_xid(pWindow);
if (xid->kind == Fl_Wayland_Window_Driver::DECORATED && !xid->frame_cb) {
xid->frame_cb = wl_surface_frame(xid->wl_surface);
wl_callback_add_listener(xid->frame_cb,
wl_callback_add_listener(xid->frame_cb,
Fl_Wayland_Graphics_Driver::p_surface_frame_listener, xid);
}
wl_egl_window_resize(egl_window, W, H, 0, 0);
Expand Down
8 changes: 4 additions & 4 deletions src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) {
// Cursor names are the files of directory /usr/share/icons/XXXX/cursors/
// where XXXX is the name of the current 'cursor theme'.
static struct cursor_file_struct {
Fl_Cursor c;
Fl_Cursor c;
const char *fname;
Fl_Wayland_Screen_Driver::cursor_shapes wld_c;
} cursor_file_array[] = {
Expand All @@ -1522,7 +1522,7 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) {
{FL_CURSOR_NESW, "fd_double_arrow", Fl_Wayland_Screen_Driver::nesw },
{FL_CURSOR_NWSE, "bd_double_arrow", Fl_Wayland_Screen_Driver::nwse }
};

int found = -1;
for (unsigned i = 0; i < sizeof(cursor_file_array) / sizeof(struct cursor_file_struct); i++) {
if (cursor_file_array[i].c == c) {
Expand All @@ -1536,7 +1536,7 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) {
}
}
if (found < 0 || !scr_driver->xc_cursor[found]) return 0;

if (xid->custom_cursor) {
delete_cursor(xid->custom_cursor);
xid->custom_cursor = NULL;
Expand Down Expand Up @@ -1781,7 +1781,7 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {

if (fl_win && fl_win->kind == SUBWINDOW && fl_win->subsurface)
checkSubwindowFrame(); // make sure subwindow doesn't leak outside parent

if (Fl_Wayland_Screen_Driver::compositor == Fl_Wayland_Screen_Driver::MUTTER &&
fl_win && is_a_resize && fl_win->kind == DECORATED) { // fix for issue #878
scan_subwindows(pWindow, does_window_cover_parent);
Expand Down
2 changes: 1 addition & 1 deletion src/fl_shortcut.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int Fl::test_shortcut(unsigned int shortcut) {
// kludge so that Ctrl+'_' works (as opposed to Ctrl+'^_'):
if ((shift&FL_CTRL) && key >= 0x3f && key <= 0x5F
&& firstChar==(key^0x40)) return 1; // firstChar should be within a-z

return 0;
}

Expand Down
Loading

0 comments on commit af90841

Please sign in to comment.