summaryrefslogtreecommitdiff
path: root/fluid/tools/autodoc.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'fluid/tools/autodoc.cxx')
-rw-r--r--fluid/tools/autodoc.cxx116
1 files changed, 60 insertions, 56 deletions
diff --git a/fluid/tools/autodoc.cxx b/fluid/tools/autodoc.cxx
index 51afe76c6..a59e08ab9 100644
--- a/fluid/tools/autodoc.cxx
+++ b/fluid/tools/autodoc.cxx
@@ -233,7 +233,7 @@ void blend_alpha_bottom(const Fl_RGB_Image *img, int dy) {
created in FLTK resolution, even if the screen uses a higher resolution.
\param[in] filename the snapshot will be written to this file in png format
- \param[in] w draw a bounding box around all widgets in the nullptr terminated list
+ \param[in] w draw a bounding box around all widgets in the 0 terminated list
\param[in] frame add a margin around the bounding box
\param[in] blend add another margin around the bounding box that fades to full transparency
\param[in] scale scale everything by this factor before saving it
@@ -343,7 +343,7 @@ int fl_snapshot(const char *filename, Fl_Widget *w1, Fl_Widget *w2,
const Fl_Rect &blend,
double scale)
{
- Fl_Widget *ww[3] = { w1, w2, nullptr };
+ Fl_Widget *ww[3] = { w1, w2, 0 };
return fl_snapshot(filename, ww, frame, blend, scale);
}
@@ -364,14 +364,18 @@ int fl_snapshot(const char *filename, Fl_Widget *w,
const Fl_Rect &blend,
double scale)
{
- Fl_Widget *ww[2] = { w, nullptr };
+ Fl_Widget *ww[2] = { w, 0 };
return fl_snapshot(filename, ww, frame, blend, scale);
}
/** @} */
-void run_autodoc(const std::string &target_dir) {
+// Helper macro to build snapshot path
+#define SNAP_PATH(filename) (snprintf(snap_path, FL_PATH_MAX, "%s%s", target_dir, filename), snap_path)
+
+void run_autodoc(const char *target_dir) {
+ char snap_path[FL_PATH_MAX];
// A list of all the margins we will use later
Fl_Margin win_margin(0, 0, 0, 0);
Fl_Margin win_blend(10, 10, 10, 10);
@@ -384,7 +388,7 @@ void run_autodoc(const std::string &target_dir) {
// Fl::scheme("gtk+");
// Create a silly project that contains all widgets that we want to document
- Fluid.new_project(false);
+ Fluid.new_project(0);
/*Node *t_func = */ add_new_widget_from_user("Function", Strategy::AS_LAST_CHILD, false);
Window_Node *t_win = (Window_Node*)add_new_widget_from_user("Fl_Window", Strategy::AS_LAST_CHILD, false);
@@ -430,9 +434,9 @@ void run_autodoc(const std::string &target_dir) {
// explain widget browser
// explain widget browser entry
Fluid.main_window->size(350, 320);
- fl_snapshot((target_dir + "main_window.png").c_str(), Fluid.main_window, win_margin, win_blend);
- fl_snapshot((target_dir + "main_menubar.png").c_str(), Fluid.main_menubar, row_margin, row_blend);
- fl_snapshot((target_dir + "main_browser.png").c_str(), widget_browser, FL_SNAP_AREA_CLEAR,
+ fl_snapshot(SNAP_PATH("main_window.png"), Fluid.main_window, win_margin, win_blend);
+ fl_snapshot(SNAP_PATH("main_menubar.png"), Fluid.main_menubar, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("main_browser.png"), widget_browser, FL_SNAP_AREA_CLEAR,
Fl_Rect(0, 30, FL_SNAP_TO_WINDOW, 100), row_blend, 2.0);
@@ -454,7 +458,7 @@ void run_autodoc(const std::string &target_dir) {
// list exceptions (subwindow, scroll)
Fl::wait(0.2);
Fl::flush();
- fl_snapshot((target_dir + "widgetbin_panel.png").c_str(), widgetbin_panel, win_margin, win_blend);
+ fl_snapshot(SNAP_PATH("widgetbin_panel.png"), widgetbin_panel, win_margin, win_blend);
// ---- code view
// explain functionality
@@ -465,35 +469,35 @@ void run_autodoc(const std::string &target_dir) {
codeview_panel->show();
Fl::wait(0.2);
Fl::flush();
- update_codeview_cb(nullptr, nullptr); // must be visible on screen for this to work
+ update_codeview_cb(0, 0); // must be visible on screen for this to work
cv_tab->value(cv_source_tab);
codeview_panel->redraw();
Fl::flush();
- fl_snapshot((target_dir + "codeview_panel.png").c_str(), codeview_panel, win_margin, win_blend);
- fl_snapshot((target_dir + "cv_find_row.png").c_str(), cv_find_row, row_margin, row_blend);
- fl_snapshot((target_dir + "cv_settings_row.png").c_str(), cv_settings_row, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("codeview_panel.png"), codeview_panel, win_margin, win_blend);
+ fl_snapshot(SNAP_PATH("cv_find_row.png"), cv_find_row, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("cv_settings_row.png"), cv_settings_row, row_margin, row_blend);
// ---- settings dialog
// show and explain all tabs
- fl_snapshot((target_dir + "w_settings.png").c_str(), settings_window, win_margin, win_blend);
- fl_snapshot((target_dir + "w_settings_general_tab.png").c_str(), w_settings_general_tab, xtab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("w_settings.png"), settings_window, win_margin, win_blend);
+ fl_snapshot(SNAP_PATH("w_settings_general_tab.png"), w_settings_general_tab, xtab_margin, row_blend);
w_settings_tabs->value(w_settings_project_tab);
- fl_snapshot((target_dir + "w_settings_project_tab.png").c_str(), w_settings_project_tab, xtab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("w_settings_project_tab.png"), w_settings_project_tab, xtab_margin, row_blend);
w_settings_tabs->value(w_settings_layout_tab);
- fl_snapshot((target_dir + "w_settings_layout_tab.png").c_str(), w_settings_layout_tab, xtab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("w_settings_layout_tab.png"), w_settings_layout_tab, xtab_margin, row_blend);
w_settings_tabs->value(w_settings_shell_tab);
w_settings_shell_list->value(1);
w_settings_shell_list->do_callback();
- fl_snapshot((target_dir + "w_settings_shell_tab.png").c_str(), w_settings_shell_tab, xtab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("w_settings_shell_tab.png"), w_settings_shell_tab, xtab_margin, row_blend);
w_settings_tabs->value(w_settings_i18n_tab);
i18n_type_chooser->value(1);
i18n_type_chooser->do_callback();
- fl_snapshot((target_dir + "w_settings_i18n_gnu.png").c_str(), i18n_type_chooser, i18n_gnu_static_function_input, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("w_settings_i18n_gnu.png"), i18n_type_chooser, i18n_gnu_static_function_input, row_margin, row_blend);
i18n_type_chooser->value(2);
i18n_type_chooser->do_callback();
- fl_snapshot((target_dir + "w_settings_i18n_psx.png").c_str(), i18n_type_chooser, i18n_pos_set_input, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("w_settings_i18n_psx.png"), i18n_type_chooser, i18n_pos_set_input, row_margin, row_blend);
w_settings_tabs->value(w_settings_user_tab);
- fl_snapshot((target_dir + "w_settings_user_tab.png").c_str(), w_settings_user_tab, xtab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("w_settings_user_tab.png"), w_settings_user_tab, xtab_margin, row_blend);
// ---- dialog types
@@ -505,33 +509,33 @@ void run_autodoc(const std::string &target_dir) {
// -- FLD_NODE_TYPE_Function
select_only(t_func);
- fl_snapshot((target_dir + "function_panel.png").c_str(), func_tabs_main, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("function_panel.png"), func_tabs_main, tab_margin, row_blend);
// -- FLD_NODE_TYPE_Code
select_only(t_code);
- fl_snapshot((target_dir + "code_panel.png").c_str(), code_tabs_main, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("code_panel.png"), code_tabs_main, tab_margin, row_blend);
// -- FLD_NODE_TYPE_CodeBlock
select_only(t_codeblock);
- fl_snapshot((target_dir + "codeblock_panel.png").c_str(), declblock_tabs_main, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("codeblock_panel.png"), declblock_tabs_main, tab_margin, row_blend);
// -- FLD_NODE_TYPE_Decl
select_only(t_decl);
- fl_snapshot((target_dir + "decl_panel.png").c_str(), decl_tabs_main, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("decl_panel.png"), decl_tabs_main, tab_margin, row_blend);
// -- FLD_NODE_TYPE_DeclBlock
select_only(t_declblock);
- fl_snapshot((target_dir + "declblock_panel.png").c_str(), declblock_tabs_main, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("declblock_panel.png"), declblock_tabs_main, tab_margin, row_blend);
// -- FLD_NODE_TYPE_Class
select_only(t_class);
- fl_snapshot((target_dir + "class_panel.png").c_str(), class_tabs_main, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("class_panel.png"), class_tabs_main, tab_margin, row_blend);
// -- FLD_NODE_TYPE_Widget_Class is handled like Window_Node
// -- FLD_NODE_TYPE_Comment
select_only(t_comment);
- fl_snapshot((target_dir + "comment_panel.png").c_str(), comment_tabs_comment, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("comment_panel.png"), comment_tabs_comment, tab_margin, row_blend);
// ---- widget dialog
t_win->open(); // open the window
@@ -539,66 +543,66 @@ void run_autodoc(const std::string &target_dir) {
select_only(t_win);
// -- snapshot of the widget properties panel
- fl_snapshot((target_dir + "widget_panel.png").c_str(), the_panel, win_margin, win_blend);
- fl_snapshot((target_dir + "wLiveMode.png").c_str(), wLiveMode, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("widget_panel.png"), the_panel, win_margin, win_blend);
+ fl_snapshot(SNAP_PATH("wLiveMode.png"), wLiveMode, row_margin, row_blend);
// -- snapshot of the GUI tab
widget_tabs->value(wp_gui_tab);
- fl_snapshot((target_dir + "wp_gui_tab.png").c_str(), wp_gui_tab, tab_margin, row_blend);
- fl_snapshot((target_dir + "wp_gui_label.png").c_str(), wp_gui_label, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_tab.png"), wp_gui_tab, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_label.png"), wp_gui_label, row_margin, row_blend);
select_only(t_btn);
- fl_snapshot((target_dir + "wp_gui_image.png").c_str(), widget_image_input, widget_deimage_input, row_margin, row_blend);
- fl_snapshot((target_dir + "wp_gui_alignment.png").c_str(), wp_gui_alignment, row_margin, row_blend);
- fl_snapshot((target_dir + "wp_gui_size.png").c_str(), widget_x_input, xrow_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_image.png"), widget_image_input, widget_deimage_input, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_alignment.png"), wp_gui_alignment, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_size.png"), widget_x_input, xrow_margin, row_blend);
select_only(t_sldr);
- fl_snapshot((target_dir + "wp_gui_values.png").c_str(), wp_gui_values, xrow_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_values.png"), wp_gui_values, xrow_margin, row_blend);
select_only(t_flxc);
- fl_snapshot((target_dir + "wp_gui_flexp.png").c_str(), wp_gui_flexp, xrow_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_flexp.png"), wp_gui_flexp, xrow_margin, row_blend);
select_only(t_flx);
- fl_snapshot((target_dir + "wp_gui_margins.png").c_str(), wp_gui_margins, xrow_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_margins.png"), wp_gui_margins, xrow_margin, row_blend);
select_only(t_win);
- fl_snapshot((target_dir + "wp_gui_sizerange.png").c_str(), wp_gui_sizerange, xrow_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_sizerange.png"), wp_gui_sizerange, xrow_margin, row_blend);
select_only(t_btn);
- fl_snapshot((target_dir + "wp_gui_shortcut.png").c_str(), wp_gui_shortcut, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_shortcut.png"), wp_gui_shortcut, row_margin, row_blend);
select_only(t_win);
- fl_snapshot((target_dir + "wp_gui_xclass.png").c_str(), wp_gui_xclass, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_xclass.png"), wp_gui_xclass, row_margin, row_blend);
select_only(t_btn);
- fl_snapshot((target_dir + "wp_gui_attributes.png").c_str(), wp_gui_attributes, row_margin, row_blend);
- fl_snapshot((target_dir + "wp_gui_tooltip.png").c_str(), wp_gui_tooltip, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_attributes.png"), wp_gui_attributes, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gui_tooltip.png"), wp_gui_tooltip, row_margin, row_blend);
// -- snapshot of the style tab
widget_tabs->value(wp_style_tab);
select_only(t_inp);
- fl_snapshot((target_dir + "wp_style_tab.png").c_str(), wp_style_tab, tab_margin, row_blend);
- fl_snapshot((target_dir + "wp_style_label.png").c_str(), wp_style_label, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_style_tab.png"), wp_style_tab, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_style_label.png"), wp_style_label, row_margin, row_blend);
select_only(t_btn);
- fl_snapshot((target_dir + "wp_style_box.png").c_str(), wp_style_box, wp_style_downbox, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_style_box.png"), wp_style_box, wp_style_downbox, row_margin, row_blend);
select_only(t_inp);
- fl_snapshot((target_dir + "wp_style_text.png").c_str(), wp_style_text, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_style_text.png"), wp_style_text, row_margin, row_blend);
// -- snapshot of the C++ tab
widget_tabs->value(wp_cpp_tab);
select_only(t_btn);
- fl_snapshot((target_dir + "wp_cpp_tab.png").c_str(), wp_cpp_tab, tab_margin, row_blend);
- fl_snapshot((target_dir + "wp_cpp_class.png").c_str(), wp_cpp_class, row_margin, row_blend);
- fl_snapshot((target_dir + "wp_cpp_name.png").c_str(), wp_cpp_name, row_margin, row_blend);
- fl_snapshot((target_dir + "v_input.png").c_str(), v_input[0], v_input[3], row_margin, row_blend);
- fl_snapshot((target_dir + "wComment.png").c_str(), wComment, row_margin, row_blend);
- fl_snapshot((target_dir + "wp_cpp_callback.png").c_str(), wCallback, w_when_box, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_cpp_tab.png"), wp_cpp_tab, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_cpp_class.png"), wp_cpp_class, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_cpp_name.png"), wp_cpp_name, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("v_input.png"), v_input[0], v_input[3], row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wComment.png"), wComment, row_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_cpp_callback.png"), wCallback, w_when_box, row_margin, row_blend);
// -- snapshot of the Grid tab
select_only(t_grd);
widget_tabs->value(widget_tab_grid);
- fl_snapshot((target_dir + "wp_grid_tab.png").c_str(), widget_tab_grid, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_grid_tab.png"), widget_tab_grid, tab_margin, row_blend);
// -- snapshot of the Grid Child tab
select_only(t_grdc);
widget_tabs->value(widget_tab_grid_child);
- fl_snapshot((target_dir + "wp_gridc_tab.png").c_str(), widget_tab_grid_child, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("wp_gridc_tab.png"), widget_tab_grid_child, tab_margin, row_blend);
// -- FLD_NODE_TYPE_Data
select_only(t_data);
- fl_snapshot((target_dir + "data_panel.png").c_str(), data_tabs_data, tab_margin, row_blend);
+ fl_snapshot(SNAP_PATH("data_panel.png"), data_tabs_data, tab_margin, row_blend);
}