From 254e11cc9af58ba7978466da54cbebf69096eb91 Mon Sep 17 00:00:00 2001 From: Nikita Kitaev Date: Thu, 15 Apr 2010 17:01:49 -0700 Subject: [PATCH] Rename gtkmm/ to gui/ --- synfig-studio/configure.ac | 2 +- synfig-studio/src/Makefile.am | 2 +- synfig-studio/src/gtkmm/Makefile.am | 387 -- synfig-studio/src/gtkmm/about.cpp | 248 -- synfig-studio/src/gtkmm/about.h | 55 - synfig-studio/src/gtkmm/adjust_window.cpp | 170 - synfig-studio/src/gtkmm/adjust_window.h | 94 - synfig-studio/src/gtkmm/app.cpp | 2515 ------------ synfig-studio/src/gtkmm/app.h | 363 -- synfig-studio/src/gtkmm/asyncrenderer.cpp | 541 --- synfig-studio/src/gtkmm/asyncrenderer.h | 123 - synfig-studio/src/gtkmm/audiocontainer.cpp | 1429 ------- synfig-studio/src/gtkmm/audiocontainer.h | 139 - synfig-studio/src/gtkmm/autorecover.cpp | 329 -- synfig-studio/src/gtkmm/autorecover.h | 75 - synfig-studio/src/gtkmm/canvasoptions.cpp | 215 - synfig-studio/src/gtkmm/canvasoptions.h | 82 - synfig-studio/src/gtkmm/canvasproperties.cpp | 255 -- synfig-studio/src/gtkmm/canvasproperties.h | 87 - synfig-studio/src/gtkmm/canvastreestore.cpp | 622 --- synfig-studio/src/gtkmm/canvastreestore.h | 195 - synfig-studio/src/gtkmm/canvasview.cpp | 4338 -------------------- synfig-studio/src/gtkmm/canvasview.h | 743 ---- synfig-studio/src/gtkmm/cellrenderer_gradient.cpp | 96 - synfig-studio/src/gtkmm/cellrenderer_gradient.h | 88 - synfig-studio/src/gtkmm/cellrenderer_time.cpp | 133 - synfig-studio/src/gtkmm/cellrenderer_time.h | 94 - synfig-studio/src/gtkmm/cellrenderer_timetrack.cpp | 906 ---- synfig-studio/src/gtkmm/cellrenderer_timetrack.h | 207 - synfig-studio/src/gtkmm/cellrenderer_value.cpp | 604 --- synfig-studio/src/gtkmm/cellrenderer_value.h | 135 - synfig-studio/src/gtkmm/childrentree.cpp | 439 -- synfig-studio/src/gtkmm/childrentree.h | 179 - synfig-studio/src/gtkmm/childrentreestore.cpp | 389 -- synfig-studio/src/gtkmm/childrentreestore.h | 143 - synfig-studio/src/gtkmm/compview.cpp | 616 --- synfig-studio/src/gtkmm/compview.h | 128 - synfig-studio/src/gtkmm/devicetracker.cpp | 150 - synfig-studio/src/gtkmm/devicetracker.h | 56 - synfig-studio/src/gtkmm/dialog_color.cpp | 155 - synfig-studio/src/gtkmm/dialog_color.h | 88 - synfig-studio/src/gtkmm/dialog_gradient.cpp | 185 - synfig-studio/src/gtkmm/dialog_gradient.h | 115 - synfig-studio/src/gtkmm/dialog_keyframe.cpp | 166 - synfig-studio/src/gtkmm/dialog_keyframe.h | 79 - synfig-studio/src/gtkmm/dialog_preview.cpp | 220 - synfig-studio/src/gtkmm/dialog_preview.h | 132 - synfig-studio/src/gtkmm/dialog_setup.cpp | 839 ---- synfig-studio/src/gtkmm/dialog_setup.h | 222 - synfig-studio/src/gtkmm/dialog_soundselect.cpp | 129 - synfig-studio/src/gtkmm/dialog_soundselect.h | 86 - synfig-studio/src/gtkmm/dialog_targetparam.cpp | 150 - synfig-studio/src/gtkmm/dialog_targetparam.h | 71 - synfig-studio/src/gtkmm/dialog_tooloptions.cpp | 97 - synfig-studio/src/gtkmm/dialog_tooloptions.h | 62 - synfig-studio/src/gtkmm/dialog_waypoint.cpp | 141 - synfig-studio/src/gtkmm/dialog_waypoint.h | 109 - synfig-studio/src/gtkmm/dialogsettings.cpp | 201 - synfig-studio/src/gtkmm/dialogsettings.h | 58 - synfig-studio/src/gtkmm/dock_canvases.cpp | 251 -- synfig-studio/src/gtkmm/dock_canvases.h | 88 - synfig-studio/src/gtkmm/dock_canvasspecific.cpp | 175 - synfig-studio/src/gtkmm/dock_canvasspecific.h | 73 - synfig-studio/src/gtkmm/dock_children.cpp | 107 - synfig-studio/src/gtkmm/dock_children.h | 60 - synfig-studio/src/gtkmm/dock_curves.cpp | 194 - synfig-studio/src/gtkmm/dock_curves.h | 74 - synfig-studio/src/gtkmm/dock_history.cpp | 447 -- synfig-studio/src/gtkmm/dock_history.h | 90 - synfig-studio/src/gtkmm/dock_info.cpp | 144 - synfig-studio/src/gtkmm/dock_info.h | 62 - synfig-studio/src/gtkmm/dock_keyframes.cpp | 138 - synfig-studio/src/gtkmm/dock_keyframes.h | 79 - synfig-studio/src/gtkmm/dock_layergroups.cpp | 136 - synfig-studio/src/gtkmm/dock_layergroups.h | 71 - synfig-studio/src/gtkmm/dock_layers.cpp | 295 -- synfig-studio/src/gtkmm/dock_layers.h | 79 - synfig-studio/src/gtkmm/dock_metadata.cpp | 144 - synfig-studio/src/gtkmm/dock_metadata.h | 71 - synfig-studio/src/gtkmm/dock_navigator.cpp | 522 --- synfig-studio/src/gtkmm/dock_navigator.h | 121 - synfig-studio/src/gtkmm/dock_params.cpp | 126 - synfig-studio/src/gtkmm/dock_params.h | 64 - synfig-studio/src/gtkmm/dock_timetrack.cpp | 494 --- synfig-studio/src/gtkmm/dock_timetrack.h | 71 - synfig-studio/src/gtkmm/dockable.cpp | 380 -- synfig-studio/src/gtkmm/dockable.h | 144 - synfig-studio/src/gtkmm/dockbook.cpp | 253 -- synfig-studio/src/gtkmm/dockbook.h | 89 - synfig-studio/src/gtkmm/dockdialog.cpp | 564 --- synfig-studio/src/gtkmm/dockdialog.h | 128 - synfig-studio/src/gtkmm/dockmanager.cpp | 328 -- synfig-studio/src/gtkmm/dockmanager.h | 82 - synfig-studio/src/gtkmm/duck.cpp | 300 -- synfig-studio/src/gtkmm/duck.h | 307 -- synfig-studio/src/gtkmm/duckmatic.cpp | 1923 --------- synfig-studio/src/gtkmm/duckmatic.h | 453 -- synfig-studio/src/gtkmm/ducktransform_rotate.h | 75 - synfig-studio/src/gtkmm/ducktransform_scale.h | 56 - synfig-studio/src/gtkmm/ducktransform_translate.h | 55 - synfig-studio/src/gtkmm/event_layerclick.h | 64 - synfig-studio/src/gtkmm/event_mouse.h | 106 - synfig-studio/src/gtkmm/eventkey.h | 74 - synfig-studio/src/gtkmm/framedial.cpp | 91 - synfig-studio/src/gtkmm/framedial.h | 79 - synfig-studio/src/gtkmm/general.h | 54 - synfig-studio/src/gtkmm/groupactionmanager.cpp | 275 -- synfig-studio/src/gtkmm/groupactionmanager.h | 85 - synfig-studio/src/gtkmm/historytreestore.cpp | 235 -- synfig-studio/src/gtkmm/historytreestore.h | 172 - synfig-studio/src/gtkmm/iconcontroller.cpp | 442 -- synfig-studio/src/gtkmm/iconcontroller.h | 73 - synfig-studio/src/gtkmm/instance.cpp | 1150 ------ synfig-studio/src/gtkmm/instance.h | 237 -- synfig-studio/src/gtkmm/ipc.cpp | 343 -- synfig-studio/src/gtkmm/ipc.h | 65 - synfig-studio/src/gtkmm/keyframeactionmanager.cpp | 251 -- synfig-studio/src/gtkmm/keyframeactionmanager.h | 91 - synfig-studio/src/gtkmm/keyframedial.cpp | 96 - synfig-studio/src/gtkmm/keyframedial.h | 74 - synfig-studio/src/gtkmm/keyframetree.cpp | 291 -- synfig-studio/src/gtkmm/keyframetree.h | 149 - synfig-studio/src/gtkmm/keyframetreestore.cpp | 901 ---- synfig-studio/src/gtkmm/keyframetreestore.h | 224 - synfig-studio/src/gtkmm/keymapsettings.cpp | 113 - synfig-studio/src/gtkmm/keymapsettings.h | 83 - synfig-studio/src/gtkmm/layeractionmanager.cpp | 524 --- synfig-studio/src/gtkmm/layeractionmanager.h | 112 - synfig-studio/src/gtkmm/layergrouptree.cpp | 334 -- synfig-studio/src/gtkmm/layergrouptree.h | 127 - synfig-studio/src/gtkmm/layergrouptreestore.cpp | 1031 ----- synfig-studio/src/gtkmm/layergrouptreestore.h | 202 - synfig-studio/src/gtkmm/layerparamtreestore.cpp | 577 --- synfig-studio/src/gtkmm/layerparamtreestore.h | 166 - synfig-studio/src/gtkmm/layertree.cpp | 1232 ------ synfig-studio/src/gtkmm/layertree.h | 261 -- synfig-studio/src/gtkmm/layertreestore.cpp | 1081 ----- synfig-studio/src/gtkmm/layertreestore.h | 226 - synfig-studio/src/gtkmm/main.cpp | 131 - synfig-studio/src/gtkmm/metadatatreestore.cpp | 152 - synfig-studio/src/gtkmm/metadatatreestore.h | 133 - synfig-studio/src/gtkmm/mod_mirror/mod_mirror.cpp | 68 - synfig-studio/src/gtkmm/mod_mirror/mod_mirror.h | 59 - .../src/gtkmm/mod_mirror/state_mirror.cpp | 336 -- synfig-studio/src/gtkmm/mod_mirror/state_mirror.h | 55 - .../src/gtkmm/mod_palette/dock_palbrowse.cpp | 62 - .../src/gtkmm/mod_palette/dock_palbrowse.h | 65 - .../src/gtkmm/mod_palette/dock_paledit.cpp | 396 -- synfig-studio/src/gtkmm/mod_palette/dock_paledit.h | 114 - .../src/gtkmm/mod_palette/mod_palette.cpp | 80 - synfig-studio/src/gtkmm/mod_palette/mod_palette.h | 64 - synfig-studio/src/gtkmm/module.cpp | 85 - synfig-studio/src/gtkmm/module.h | 67 - synfig-studio/src/gtkmm/onemoment.cpp | 121 - synfig-studio/src/gtkmm/onemoment.h | 56 - synfig-studio/src/gtkmm/preview.cpp | 893 ---- synfig-studio/src/gtkmm/preview.h | 260 -- synfig-studio/src/gtkmm/renddesc.cpp | 620 --- synfig-studio/src/gtkmm/renddesc.h | 161 - synfig-studio/src/gtkmm/render.cpp | 380 -- synfig-studio/src/gtkmm/render.h | 108 - synfig-studio/src/gtkmm/renderer_bbox.cpp | 144 - synfig-studio/src/gtkmm/renderer_bbox.h | 63 - synfig-studio/src/gtkmm/renderer_canvas.cpp | 219 - synfig-studio/src/gtkmm/renderer_canvas.h | 63 - synfig-studio/src/gtkmm/renderer_dragbox.cpp | 154 - synfig-studio/src/gtkmm/renderer_dragbox.h | 61 - synfig-studio/src/gtkmm/renderer_ducks.cpp | 489 --- synfig-studio/src/gtkmm/renderer_ducks.h | 84 - synfig-studio/src/gtkmm/renderer_grid.cpp | 173 - synfig-studio/src/gtkmm/renderer_grid.h | 59 - synfig-studio/src/gtkmm/renderer_guides.cpp | 284 -- synfig-studio/src/gtkmm/renderer_guides.h | 62 - synfig-studio/src/gtkmm/renderer_timecode.cpp | 169 - synfig-studio/src/gtkmm/renderer_timecode.h | 59 - synfig-studio/src/gtkmm/resolutiondial.cpp | 96 - synfig-studio/src/gtkmm/resolutiondial.h | 77 - synfig-studio/src/gtkmm/smach.h | 49 - synfig-studio/src/gtkmm/splash.cpp | 252 -- synfig-studio/src/gtkmm/splash.h | 72 - synfig-studio/src/gtkmm/state_bline.cpp | 1414 ------- synfig-studio/src/gtkmm/state_bline.h | 55 - synfig-studio/src/gtkmm/state_circle.cpp | 1066 ----- synfig-studio/src/gtkmm/state_circle.h | 56 - synfig-studio/src/gtkmm/state_draw.cpp | 2036 --------- synfig-studio/src/gtkmm/state_draw.h | 56 - synfig-studio/src/gtkmm/state_eyedrop.cpp | 146 - synfig-studio/src/gtkmm/state_eyedrop.h | 56 - synfig-studio/src/gtkmm/state_fill.cpp | 182 - synfig-studio/src/gtkmm/state_fill.h | 56 - synfig-studio/src/gtkmm/state_gradient.cpp | 546 --- synfig-studio/src/gtkmm/state_gradient.h | 56 - synfig-studio/src/gtkmm/state_normal.cpp | 824 ---- synfig-studio/src/gtkmm/state_normal.h | 57 - synfig-studio/src/gtkmm/state_polygon.cpp | 945 ----- synfig-studio/src/gtkmm/state_polygon.h | 55 - synfig-studio/src/gtkmm/state_rectangle.cpp | 875 ---- synfig-studio/src/gtkmm/state_rectangle.h | 56 - synfig-studio/src/gtkmm/state_rotate.cpp | 398 -- synfig-studio/src/gtkmm/state_rotate.h | 56 - synfig-studio/src/gtkmm/state_scale.cpp | 389 -- synfig-studio/src/gtkmm/state_scale.h | 55 - synfig-studio/src/gtkmm/state_sketch.cpp | 508 --- synfig-studio/src/gtkmm/state_sketch.h | 55 - synfig-studio/src/gtkmm/state_smoothmove.cpp | 388 -- synfig-studio/src/gtkmm/state_smoothmove.h | 56 - synfig-studio/src/gtkmm/state_star.cpp | 1091 ----- synfig-studio/src/gtkmm/state_star.h | 57 - synfig-studio/src/gtkmm/state_stroke.cpp | 198 - synfig-studio/src/gtkmm/state_stroke.h | 80 - synfig-studio/src/gtkmm/state_text.cpp | 460 --- synfig-studio/src/gtkmm/state_text.h | 57 - synfig-studio/src/gtkmm/state_width.cpp | 606 --- synfig-studio/src/gtkmm/state_width.h | 56 - synfig-studio/src/gtkmm/state_zoom.cpp | 263 -- synfig-studio/src/gtkmm/state_zoom.h | 55 - synfig-studio/src/gtkmm/statemanager.cpp | 128 - synfig-studio/src/gtkmm/statemanager.h | 69 - synfig-studio/src/gtkmm/toggleducksdial.cpp | 95 - synfig-studio/src/gtkmm/toggleducksdial.h | 81 - synfig-studio/src/gtkmm/toolbox.cpp | 648 --- synfig-studio/src/gtkmm/toolbox.h | 108 - synfig-studio/src/gtkmm/valuelink.cpp | 172 - synfig-studio/src/gtkmm/valuelink.h | 82 - synfig-studio/src/gtkmm/widget_canvaschooser.cpp | 167 - synfig-studio/src/gtkmm/widget_canvaschooser.h | 67 - synfig-studio/src/gtkmm/widget_color.cpp | 200 - synfig-studio/src/gtkmm/widget_color.h | 80 - synfig-studio/src/gtkmm/widget_coloredit.cpp | 587 --- synfig-studio/src/gtkmm/widget_coloredit.h | 188 - synfig-studio/src/gtkmm/widget_compselect.cpp | 173 - synfig-studio/src/gtkmm/widget_compselect.h | 74 - synfig-studio/src/gtkmm/widget_curves.cpp | 588 --- synfig-studio/src/gtkmm/widget_curves.h | 81 - synfig-studio/src/gtkmm/widget_defaults.cpp | 611 --- synfig-studio/src/gtkmm/widget_defaults.h | 99 - synfig-studio/src/gtkmm/widget_distance.cpp | 99 - synfig-studio/src/gtkmm/widget_distance.h | 72 - synfig-studio/src/gtkmm/widget_enum.cpp | 115 - synfig-studio/src/gtkmm/widget_enum.h | 67 - synfig-studio/src/gtkmm/widget_filename.cpp | 134 - synfig-studio/src/gtkmm/widget_filename.h | 73 - synfig-studio/src/gtkmm/widget_gradient.cpp | 370 -- synfig-studio/src/gtkmm/widget_gradient.h | 102 - synfig-studio/src/gtkmm/widget_keyframe_list.cpp | 425 -- synfig-studio/src/gtkmm/widget_keyframe_list.h | 150 - synfig-studio/src/gtkmm/widget_sound.cpp | 323 -- synfig-studio/src/gtkmm/widget_sound.h | 99 - synfig-studio/src/gtkmm/widget_time.cpp | 167 - synfig-studio/src/gtkmm/widget_time.h | 84 - synfig-studio/src/gtkmm/widget_timeslider.cpp | 966 ----- synfig-studio/src/gtkmm/widget_timeslider.h | 133 - synfig-studio/src/gtkmm/widget_value.cpp | 486 --- synfig-studio/src/gtkmm/widget_value.h | 136 - synfig-studio/src/gtkmm/widget_vector.cpp | 244 -- synfig-studio/src/gtkmm/widget_vector.h | 96 - synfig-studio/src/gtkmm/widget_waypoint.cpp | 281 -- synfig-studio/src/gtkmm/widget_waypoint.h | 96 - synfig-studio/src/gtkmm/widget_waypointmodel.cpp | 191 - synfig-studio/src/gtkmm/widget_waypointmodel.h | 95 - synfig-studio/src/gtkmm/workarea.cpp | 2798 ------------- synfig-studio/src/gtkmm/workarea.h | 515 --- synfig-studio/src/gtkmm/workarearenderer.cpp | 134 - synfig-studio/src/gtkmm/workarearenderer.h | 116 - synfig-studio/src/gtkmm/zoomdial.cpp | 81 - synfig-studio/src/gtkmm/zoomdial.h | 70 - synfig-studio/src/gui/Makefile.am | 387 ++ synfig-studio/src/gui/about.cpp | 248 ++ synfig-studio/src/gui/about.h | 55 + synfig-studio/src/gui/adjust_window.cpp | 170 + synfig-studio/src/gui/adjust_window.h | 94 + synfig-studio/src/gui/app.cpp | 2515 ++++++++++++ synfig-studio/src/gui/app.h | 363 ++ synfig-studio/src/gui/asyncrenderer.cpp | 541 +++ synfig-studio/src/gui/asyncrenderer.h | 123 + synfig-studio/src/gui/audiocontainer.cpp | 1429 +++++++ synfig-studio/src/gui/audiocontainer.h | 139 + synfig-studio/src/gui/autorecover.cpp | 329 ++ synfig-studio/src/gui/autorecover.h | 75 + synfig-studio/src/gui/canvasoptions.cpp | 215 + synfig-studio/src/gui/canvasoptions.h | 82 + synfig-studio/src/gui/canvasproperties.cpp | 255 ++ synfig-studio/src/gui/canvasproperties.h | 87 + synfig-studio/src/gui/canvastreestore.cpp | 622 +++ synfig-studio/src/gui/canvastreestore.h | 195 + synfig-studio/src/gui/canvasview.cpp | 4338 ++++++++++++++++++++ synfig-studio/src/gui/canvasview.h | 743 ++++ synfig-studio/src/gui/cellrenderer_gradient.cpp | 96 + synfig-studio/src/gui/cellrenderer_gradient.h | 88 + synfig-studio/src/gui/cellrenderer_time.cpp | 133 + synfig-studio/src/gui/cellrenderer_time.h | 94 + synfig-studio/src/gui/cellrenderer_timetrack.cpp | 906 ++++ synfig-studio/src/gui/cellrenderer_timetrack.h | 207 + synfig-studio/src/gui/cellrenderer_value.cpp | 604 +++ synfig-studio/src/gui/cellrenderer_value.h | 135 + synfig-studio/src/gui/childrentree.cpp | 439 ++ synfig-studio/src/gui/childrentree.h | 179 + synfig-studio/src/gui/childrentreestore.cpp | 389 ++ synfig-studio/src/gui/childrentreestore.h | 143 + synfig-studio/src/gui/compview.cpp | 616 +++ synfig-studio/src/gui/compview.h | 128 + synfig-studio/src/gui/devicetracker.cpp | 150 + synfig-studio/src/gui/devicetracker.h | 56 + synfig-studio/src/gui/dialog_color.cpp | 155 + synfig-studio/src/gui/dialog_color.h | 88 + synfig-studio/src/gui/dialog_gradient.cpp | 185 + synfig-studio/src/gui/dialog_gradient.h | 115 + synfig-studio/src/gui/dialog_keyframe.cpp | 166 + synfig-studio/src/gui/dialog_keyframe.h | 79 + synfig-studio/src/gui/dialog_preview.cpp | 220 + synfig-studio/src/gui/dialog_preview.h | 132 + synfig-studio/src/gui/dialog_setup.cpp | 839 ++++ synfig-studio/src/gui/dialog_setup.h | 222 + synfig-studio/src/gui/dialog_soundselect.cpp | 129 + synfig-studio/src/gui/dialog_soundselect.h | 86 + synfig-studio/src/gui/dialog_targetparam.cpp | 150 + synfig-studio/src/gui/dialog_targetparam.h | 71 + synfig-studio/src/gui/dialog_tooloptions.cpp | 97 + synfig-studio/src/gui/dialog_tooloptions.h | 62 + synfig-studio/src/gui/dialog_waypoint.cpp | 141 + synfig-studio/src/gui/dialog_waypoint.h | 109 + synfig-studio/src/gui/dialogsettings.cpp | 201 + synfig-studio/src/gui/dialogsettings.h | 58 + synfig-studio/src/gui/dock_canvases.cpp | 251 ++ synfig-studio/src/gui/dock_canvases.h | 88 + synfig-studio/src/gui/dock_canvasspecific.cpp | 175 + synfig-studio/src/gui/dock_canvasspecific.h | 73 + synfig-studio/src/gui/dock_children.cpp | 107 + synfig-studio/src/gui/dock_children.h | 60 + synfig-studio/src/gui/dock_curves.cpp | 194 + synfig-studio/src/gui/dock_curves.h | 74 + synfig-studio/src/gui/dock_history.cpp | 447 ++ synfig-studio/src/gui/dock_history.h | 90 + synfig-studio/src/gui/dock_info.cpp | 144 + synfig-studio/src/gui/dock_info.h | 62 + synfig-studio/src/gui/dock_keyframes.cpp | 138 + synfig-studio/src/gui/dock_keyframes.h | 79 + synfig-studio/src/gui/dock_layergroups.cpp | 136 + synfig-studio/src/gui/dock_layergroups.h | 71 + synfig-studio/src/gui/dock_layers.cpp | 295 ++ synfig-studio/src/gui/dock_layers.h | 79 + synfig-studio/src/gui/dock_metadata.cpp | 144 + synfig-studio/src/gui/dock_metadata.h | 71 + synfig-studio/src/gui/dock_navigator.cpp | 522 +++ synfig-studio/src/gui/dock_navigator.h | 121 + synfig-studio/src/gui/dock_params.cpp | 126 + synfig-studio/src/gui/dock_params.h | 64 + synfig-studio/src/gui/dock_timetrack.cpp | 494 +++ synfig-studio/src/gui/dock_timetrack.h | 71 + synfig-studio/src/gui/dockable.cpp | 380 ++ synfig-studio/src/gui/dockable.h | 144 + synfig-studio/src/gui/dockbook.cpp | 253 ++ synfig-studio/src/gui/dockbook.h | 89 + synfig-studio/src/gui/dockdialog.cpp | 564 +++ synfig-studio/src/gui/dockdialog.h | 128 + synfig-studio/src/gui/dockmanager.cpp | 328 ++ synfig-studio/src/gui/dockmanager.h | 82 + synfig-studio/src/gui/duck.cpp | 300 ++ synfig-studio/src/gui/duck.h | 307 ++ synfig-studio/src/gui/duckmatic.cpp | 1923 +++++++++ synfig-studio/src/gui/duckmatic.h | 453 ++ synfig-studio/src/gui/ducktransform_rotate.h | 75 + synfig-studio/src/gui/ducktransform_scale.h | 56 + synfig-studio/src/gui/ducktransform_translate.h | 55 + synfig-studio/src/gui/event_layerclick.h | 64 + synfig-studio/src/gui/event_mouse.h | 106 + synfig-studio/src/gui/eventkey.h | 74 + synfig-studio/src/gui/framedial.cpp | 91 + synfig-studio/src/gui/framedial.h | 79 + synfig-studio/src/gui/general.h | 54 + synfig-studio/src/gui/groupactionmanager.cpp | 275 ++ synfig-studio/src/gui/groupactionmanager.h | 85 + synfig-studio/src/gui/historytreestore.cpp | 235 ++ synfig-studio/src/gui/historytreestore.h | 172 + synfig-studio/src/gui/iconcontroller.cpp | 442 ++ synfig-studio/src/gui/iconcontroller.h | 73 + synfig-studio/src/gui/instance.cpp | 1150 ++++++ synfig-studio/src/gui/instance.h | 237 ++ synfig-studio/src/gui/ipc.cpp | 343 ++ synfig-studio/src/gui/ipc.h | 65 + synfig-studio/src/gui/keyframeactionmanager.cpp | 251 ++ synfig-studio/src/gui/keyframeactionmanager.h | 91 + synfig-studio/src/gui/keyframedial.cpp | 96 + synfig-studio/src/gui/keyframedial.h | 74 + synfig-studio/src/gui/keyframetree.cpp | 291 ++ synfig-studio/src/gui/keyframetree.h | 149 + synfig-studio/src/gui/keyframetreestore.cpp | 901 ++++ synfig-studio/src/gui/keyframetreestore.h | 224 + synfig-studio/src/gui/keymapsettings.cpp | 113 + synfig-studio/src/gui/keymapsettings.h | 83 + synfig-studio/src/gui/layeractionmanager.cpp | 524 +++ synfig-studio/src/gui/layeractionmanager.h | 112 + synfig-studio/src/gui/layergrouptree.cpp | 334 ++ synfig-studio/src/gui/layergrouptree.h | 127 + synfig-studio/src/gui/layergrouptreestore.cpp | 1031 +++++ synfig-studio/src/gui/layergrouptreestore.h | 202 + synfig-studio/src/gui/layerparamtreestore.cpp | 577 +++ synfig-studio/src/gui/layerparamtreestore.h | 166 + synfig-studio/src/gui/layertree.cpp | 1232 ++++++ synfig-studio/src/gui/layertree.h | 261 ++ synfig-studio/src/gui/layertreestore.cpp | 1081 +++++ synfig-studio/src/gui/layertreestore.h | 226 + synfig-studio/src/gui/main.cpp | 131 + synfig-studio/src/gui/metadatatreestore.cpp | 152 + synfig-studio/src/gui/metadatatreestore.h | 133 + synfig-studio/src/gui/mod_mirror/mod_mirror.cpp | 68 + synfig-studio/src/gui/mod_mirror/mod_mirror.h | 59 + synfig-studio/src/gui/mod_mirror/state_mirror.cpp | 336 ++ synfig-studio/src/gui/mod_mirror/state_mirror.h | 55 + .../src/gui/mod_palette/dock_palbrowse.cpp | 62 + synfig-studio/src/gui/mod_palette/dock_palbrowse.h | 65 + synfig-studio/src/gui/mod_palette/dock_paledit.cpp | 396 ++ synfig-studio/src/gui/mod_palette/dock_paledit.h | 114 + synfig-studio/src/gui/mod_palette/mod_palette.cpp | 80 + synfig-studio/src/gui/mod_palette/mod_palette.h | 64 + synfig-studio/src/gui/module.cpp | 85 + synfig-studio/src/gui/module.h | 67 + synfig-studio/src/gui/onemoment.cpp | 121 + synfig-studio/src/gui/onemoment.h | 56 + synfig-studio/src/gui/preview.cpp | 893 ++++ synfig-studio/src/gui/preview.h | 260 ++ synfig-studio/src/gui/renddesc.cpp | 620 +++ synfig-studio/src/gui/renddesc.h | 161 + synfig-studio/src/gui/render.cpp | 380 ++ synfig-studio/src/gui/render.h | 108 + synfig-studio/src/gui/renderer_bbox.cpp | 144 + synfig-studio/src/gui/renderer_bbox.h | 63 + synfig-studio/src/gui/renderer_canvas.cpp | 219 + synfig-studio/src/gui/renderer_canvas.h | 63 + synfig-studio/src/gui/renderer_dragbox.cpp | 154 + synfig-studio/src/gui/renderer_dragbox.h | 61 + synfig-studio/src/gui/renderer_ducks.cpp | 489 +++ synfig-studio/src/gui/renderer_ducks.h | 84 + synfig-studio/src/gui/renderer_grid.cpp | 173 + synfig-studio/src/gui/renderer_grid.h | 59 + synfig-studio/src/gui/renderer_guides.cpp | 284 ++ synfig-studio/src/gui/renderer_guides.h | 62 + synfig-studio/src/gui/renderer_timecode.cpp | 169 + synfig-studio/src/gui/renderer_timecode.h | 59 + synfig-studio/src/gui/resolutiondial.cpp | 96 + synfig-studio/src/gui/resolutiondial.h | 77 + synfig-studio/src/gui/smach.h | 49 + synfig-studio/src/gui/splash.cpp | 252 ++ synfig-studio/src/gui/splash.h | 72 + synfig-studio/src/gui/state_bline.cpp | 1414 +++++++ synfig-studio/src/gui/state_bline.h | 55 + synfig-studio/src/gui/state_circle.cpp | 1066 +++++ synfig-studio/src/gui/state_circle.h | 56 + synfig-studio/src/gui/state_draw.cpp | 2036 +++++++++ synfig-studio/src/gui/state_draw.h | 56 + synfig-studio/src/gui/state_eyedrop.cpp | 146 + synfig-studio/src/gui/state_eyedrop.h | 56 + synfig-studio/src/gui/state_fill.cpp | 182 + synfig-studio/src/gui/state_fill.h | 56 + synfig-studio/src/gui/state_gradient.cpp | 546 +++ synfig-studio/src/gui/state_gradient.h | 56 + synfig-studio/src/gui/state_normal.cpp | 824 ++++ synfig-studio/src/gui/state_normal.h | 57 + synfig-studio/src/gui/state_polygon.cpp | 945 +++++ synfig-studio/src/gui/state_polygon.h | 55 + synfig-studio/src/gui/state_rectangle.cpp | 875 ++++ synfig-studio/src/gui/state_rectangle.h | 56 + synfig-studio/src/gui/state_rotate.cpp | 398 ++ synfig-studio/src/gui/state_rotate.h | 56 + synfig-studio/src/gui/state_scale.cpp | 389 ++ synfig-studio/src/gui/state_scale.h | 55 + synfig-studio/src/gui/state_sketch.cpp | 508 +++ synfig-studio/src/gui/state_sketch.h | 55 + synfig-studio/src/gui/state_smoothmove.cpp | 388 ++ synfig-studio/src/gui/state_smoothmove.h | 56 + synfig-studio/src/gui/state_star.cpp | 1091 +++++ synfig-studio/src/gui/state_star.h | 57 + synfig-studio/src/gui/state_stroke.cpp | 198 + synfig-studio/src/gui/state_stroke.h | 80 + synfig-studio/src/gui/state_text.cpp | 460 +++ synfig-studio/src/gui/state_text.h | 57 + synfig-studio/src/gui/state_width.cpp | 606 +++ synfig-studio/src/gui/state_width.h | 56 + synfig-studio/src/gui/state_zoom.cpp | 263 ++ synfig-studio/src/gui/state_zoom.h | 55 + synfig-studio/src/gui/statemanager.cpp | 128 + synfig-studio/src/gui/statemanager.h | 69 + synfig-studio/src/gui/toggleducksdial.cpp | 95 + synfig-studio/src/gui/toggleducksdial.h | 81 + synfig-studio/src/gui/toolbox.cpp | 648 +++ synfig-studio/src/gui/toolbox.h | 108 + synfig-studio/src/gui/valuelink.cpp | 172 + synfig-studio/src/gui/valuelink.h | 82 + synfig-studio/src/gui/widget_canvaschooser.cpp | 167 + synfig-studio/src/gui/widget_canvaschooser.h | 67 + synfig-studio/src/gui/widget_color.cpp | 200 + synfig-studio/src/gui/widget_color.h | 80 + synfig-studio/src/gui/widget_coloredit.cpp | 587 +++ synfig-studio/src/gui/widget_coloredit.h | 188 + synfig-studio/src/gui/widget_compselect.cpp | 173 + synfig-studio/src/gui/widget_compselect.h | 74 + synfig-studio/src/gui/widget_curves.cpp | 588 +++ synfig-studio/src/gui/widget_curves.h | 81 + synfig-studio/src/gui/widget_defaults.cpp | 611 +++ synfig-studio/src/gui/widget_defaults.h | 99 + synfig-studio/src/gui/widget_distance.cpp | 99 + synfig-studio/src/gui/widget_distance.h | 72 + synfig-studio/src/gui/widget_enum.cpp | 115 + synfig-studio/src/gui/widget_enum.h | 67 + synfig-studio/src/gui/widget_filename.cpp | 134 + synfig-studio/src/gui/widget_filename.h | 73 + synfig-studio/src/gui/widget_gradient.cpp | 370 ++ synfig-studio/src/gui/widget_gradient.h | 102 + synfig-studio/src/gui/widget_keyframe_list.cpp | 425 ++ synfig-studio/src/gui/widget_keyframe_list.h | 150 + synfig-studio/src/gui/widget_sound.cpp | 323 ++ synfig-studio/src/gui/widget_sound.h | 99 + synfig-studio/src/gui/widget_time.cpp | 167 + synfig-studio/src/gui/widget_time.h | 84 + synfig-studio/src/gui/widget_timeslider.cpp | 966 +++++ synfig-studio/src/gui/widget_timeslider.h | 133 + synfig-studio/src/gui/widget_value.cpp | 486 +++ synfig-studio/src/gui/widget_value.h | 136 + synfig-studio/src/gui/widget_vector.cpp | 244 ++ synfig-studio/src/gui/widget_vector.h | 96 + synfig-studio/src/gui/widget_waypoint.cpp | 281 ++ synfig-studio/src/gui/widget_waypoint.h | 96 + synfig-studio/src/gui/widget_waypointmodel.cpp | 191 + synfig-studio/src/gui/widget_waypointmodel.h | 95 + synfig-studio/src/gui/workarea.cpp | 2798 +++++++++++++ synfig-studio/src/gui/workarea.h | 515 +++ synfig-studio/src/gui/workarearenderer.cpp | 134 + synfig-studio/src/gui/workarearenderer.h | 116 + synfig-studio/src/gui/zoomdial.cpp | 81 + synfig-studio/src/gui/zoomdial.h | 70 + 530 files changed, 75155 insertions(+), 75155 deletions(-) delete mode 100644 synfig-studio/src/gtkmm/Makefile.am delete mode 100644 synfig-studio/src/gtkmm/about.cpp delete mode 100644 synfig-studio/src/gtkmm/about.h delete mode 100644 synfig-studio/src/gtkmm/adjust_window.cpp delete mode 100644 synfig-studio/src/gtkmm/adjust_window.h delete mode 100644 synfig-studio/src/gtkmm/app.cpp delete mode 100644 synfig-studio/src/gtkmm/app.h delete mode 100644 synfig-studio/src/gtkmm/asyncrenderer.cpp delete mode 100644 synfig-studio/src/gtkmm/asyncrenderer.h delete mode 100644 synfig-studio/src/gtkmm/audiocontainer.cpp delete mode 100644 synfig-studio/src/gtkmm/audiocontainer.h delete mode 100644 synfig-studio/src/gtkmm/autorecover.cpp delete mode 100644 synfig-studio/src/gtkmm/autorecover.h delete mode 100644 synfig-studio/src/gtkmm/canvasoptions.cpp delete mode 100644 synfig-studio/src/gtkmm/canvasoptions.h delete mode 100644 synfig-studio/src/gtkmm/canvasproperties.cpp delete mode 100644 synfig-studio/src/gtkmm/canvasproperties.h delete mode 100644 synfig-studio/src/gtkmm/canvastreestore.cpp delete mode 100644 synfig-studio/src/gtkmm/canvastreestore.h delete mode 100644 synfig-studio/src/gtkmm/canvasview.cpp delete mode 100644 synfig-studio/src/gtkmm/canvasview.h delete mode 100644 synfig-studio/src/gtkmm/cellrenderer_gradient.cpp delete mode 100644 synfig-studio/src/gtkmm/cellrenderer_gradient.h delete mode 100644 synfig-studio/src/gtkmm/cellrenderer_time.cpp delete mode 100644 synfig-studio/src/gtkmm/cellrenderer_time.h delete mode 100644 synfig-studio/src/gtkmm/cellrenderer_timetrack.cpp delete mode 100644 synfig-studio/src/gtkmm/cellrenderer_timetrack.h delete mode 100644 synfig-studio/src/gtkmm/cellrenderer_value.cpp delete mode 100644 synfig-studio/src/gtkmm/cellrenderer_value.h delete mode 100644 synfig-studio/src/gtkmm/childrentree.cpp delete mode 100644 synfig-studio/src/gtkmm/childrentree.h delete mode 100644 synfig-studio/src/gtkmm/childrentreestore.cpp delete mode 100644 synfig-studio/src/gtkmm/childrentreestore.h delete mode 100644 synfig-studio/src/gtkmm/compview.cpp delete mode 100644 synfig-studio/src/gtkmm/compview.h delete mode 100644 synfig-studio/src/gtkmm/devicetracker.cpp delete mode 100644 synfig-studio/src/gtkmm/devicetracker.h delete mode 100644 synfig-studio/src/gtkmm/dialog_color.cpp delete mode 100644 synfig-studio/src/gtkmm/dialog_color.h delete mode 100644 synfig-studio/src/gtkmm/dialog_gradient.cpp delete mode 100644 synfig-studio/src/gtkmm/dialog_gradient.h delete mode 100644 synfig-studio/src/gtkmm/dialog_keyframe.cpp delete mode 100644 synfig-studio/src/gtkmm/dialog_keyframe.h delete mode 100644 synfig-studio/src/gtkmm/dialog_preview.cpp delete mode 100644 synfig-studio/src/gtkmm/dialog_preview.h delete mode 100644 synfig-studio/src/gtkmm/dialog_setup.cpp delete mode 100644 synfig-studio/src/gtkmm/dialog_setup.h delete mode 100644 synfig-studio/src/gtkmm/dialog_soundselect.cpp delete mode 100644 synfig-studio/src/gtkmm/dialog_soundselect.h delete mode 100644 synfig-studio/src/gtkmm/dialog_targetparam.cpp delete mode 100644 synfig-studio/src/gtkmm/dialog_targetparam.h delete mode 100644 synfig-studio/src/gtkmm/dialog_tooloptions.cpp delete mode 100644 synfig-studio/src/gtkmm/dialog_tooloptions.h delete mode 100644 synfig-studio/src/gtkmm/dialog_waypoint.cpp delete mode 100644 synfig-studio/src/gtkmm/dialog_waypoint.h delete mode 100644 synfig-studio/src/gtkmm/dialogsettings.cpp delete mode 100644 synfig-studio/src/gtkmm/dialogsettings.h delete mode 100644 synfig-studio/src/gtkmm/dock_canvases.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_canvases.h delete mode 100644 synfig-studio/src/gtkmm/dock_canvasspecific.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_canvasspecific.h delete mode 100644 synfig-studio/src/gtkmm/dock_children.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_children.h delete mode 100644 synfig-studio/src/gtkmm/dock_curves.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_curves.h delete mode 100644 synfig-studio/src/gtkmm/dock_history.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_history.h delete mode 100644 synfig-studio/src/gtkmm/dock_info.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_info.h delete mode 100644 synfig-studio/src/gtkmm/dock_keyframes.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_keyframes.h delete mode 100644 synfig-studio/src/gtkmm/dock_layergroups.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_layergroups.h delete mode 100644 synfig-studio/src/gtkmm/dock_layers.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_layers.h delete mode 100644 synfig-studio/src/gtkmm/dock_metadata.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_metadata.h delete mode 100644 synfig-studio/src/gtkmm/dock_navigator.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_navigator.h delete mode 100644 synfig-studio/src/gtkmm/dock_params.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_params.h delete mode 100644 synfig-studio/src/gtkmm/dock_timetrack.cpp delete mode 100644 synfig-studio/src/gtkmm/dock_timetrack.h delete mode 100644 synfig-studio/src/gtkmm/dockable.cpp delete mode 100644 synfig-studio/src/gtkmm/dockable.h delete mode 100644 synfig-studio/src/gtkmm/dockbook.cpp delete mode 100644 synfig-studio/src/gtkmm/dockbook.h delete mode 100644 synfig-studio/src/gtkmm/dockdialog.cpp delete mode 100644 synfig-studio/src/gtkmm/dockdialog.h delete mode 100644 synfig-studio/src/gtkmm/dockmanager.cpp delete mode 100644 synfig-studio/src/gtkmm/dockmanager.h delete mode 100644 synfig-studio/src/gtkmm/duck.cpp delete mode 100644 synfig-studio/src/gtkmm/duck.h delete mode 100644 synfig-studio/src/gtkmm/duckmatic.cpp delete mode 100644 synfig-studio/src/gtkmm/duckmatic.h delete mode 100644 synfig-studio/src/gtkmm/ducktransform_rotate.h delete mode 100644 synfig-studio/src/gtkmm/ducktransform_scale.h delete mode 100644 synfig-studio/src/gtkmm/ducktransform_translate.h delete mode 100644 synfig-studio/src/gtkmm/event_layerclick.h delete mode 100644 synfig-studio/src/gtkmm/event_mouse.h delete mode 100644 synfig-studio/src/gtkmm/eventkey.h delete mode 100644 synfig-studio/src/gtkmm/framedial.cpp delete mode 100644 synfig-studio/src/gtkmm/framedial.h delete mode 100644 synfig-studio/src/gtkmm/general.h delete mode 100644 synfig-studio/src/gtkmm/groupactionmanager.cpp delete mode 100644 synfig-studio/src/gtkmm/groupactionmanager.h delete mode 100644 synfig-studio/src/gtkmm/historytreestore.cpp delete mode 100644 synfig-studio/src/gtkmm/historytreestore.h delete mode 100644 synfig-studio/src/gtkmm/iconcontroller.cpp delete mode 100644 synfig-studio/src/gtkmm/iconcontroller.h delete mode 100644 synfig-studio/src/gtkmm/instance.cpp delete mode 100644 synfig-studio/src/gtkmm/instance.h delete mode 100644 synfig-studio/src/gtkmm/ipc.cpp delete mode 100644 synfig-studio/src/gtkmm/ipc.h delete mode 100644 synfig-studio/src/gtkmm/keyframeactionmanager.cpp delete mode 100644 synfig-studio/src/gtkmm/keyframeactionmanager.h delete mode 100644 synfig-studio/src/gtkmm/keyframedial.cpp delete mode 100644 synfig-studio/src/gtkmm/keyframedial.h delete mode 100644 synfig-studio/src/gtkmm/keyframetree.cpp delete mode 100644 synfig-studio/src/gtkmm/keyframetree.h delete mode 100644 synfig-studio/src/gtkmm/keyframetreestore.cpp delete mode 100644 synfig-studio/src/gtkmm/keyframetreestore.h delete mode 100644 synfig-studio/src/gtkmm/keymapsettings.cpp delete mode 100644 synfig-studio/src/gtkmm/keymapsettings.h delete mode 100644 synfig-studio/src/gtkmm/layeractionmanager.cpp delete mode 100644 synfig-studio/src/gtkmm/layeractionmanager.h delete mode 100644 synfig-studio/src/gtkmm/layergrouptree.cpp delete mode 100644 synfig-studio/src/gtkmm/layergrouptree.h delete mode 100644 synfig-studio/src/gtkmm/layergrouptreestore.cpp delete mode 100644 synfig-studio/src/gtkmm/layergrouptreestore.h delete mode 100644 synfig-studio/src/gtkmm/layerparamtreestore.cpp delete mode 100644 synfig-studio/src/gtkmm/layerparamtreestore.h delete mode 100644 synfig-studio/src/gtkmm/layertree.cpp delete mode 100644 synfig-studio/src/gtkmm/layertree.h delete mode 100644 synfig-studio/src/gtkmm/layertreestore.cpp delete mode 100644 synfig-studio/src/gtkmm/layertreestore.h delete mode 100644 synfig-studio/src/gtkmm/main.cpp delete mode 100644 synfig-studio/src/gtkmm/metadatatreestore.cpp delete mode 100644 synfig-studio/src/gtkmm/metadatatreestore.h delete mode 100644 synfig-studio/src/gtkmm/mod_mirror/mod_mirror.cpp delete mode 100644 synfig-studio/src/gtkmm/mod_mirror/mod_mirror.h delete mode 100644 synfig-studio/src/gtkmm/mod_mirror/state_mirror.cpp delete mode 100644 synfig-studio/src/gtkmm/mod_mirror/state_mirror.h delete mode 100644 synfig-studio/src/gtkmm/mod_palette/dock_palbrowse.cpp delete mode 100644 synfig-studio/src/gtkmm/mod_palette/dock_palbrowse.h delete mode 100644 synfig-studio/src/gtkmm/mod_palette/dock_paledit.cpp delete mode 100644 synfig-studio/src/gtkmm/mod_palette/dock_paledit.h delete mode 100644 synfig-studio/src/gtkmm/mod_palette/mod_palette.cpp delete mode 100644 synfig-studio/src/gtkmm/mod_palette/mod_palette.h delete mode 100644 synfig-studio/src/gtkmm/module.cpp delete mode 100644 synfig-studio/src/gtkmm/module.h delete mode 100644 synfig-studio/src/gtkmm/onemoment.cpp delete mode 100644 synfig-studio/src/gtkmm/onemoment.h delete mode 100644 synfig-studio/src/gtkmm/preview.cpp delete mode 100644 synfig-studio/src/gtkmm/preview.h delete mode 100644 synfig-studio/src/gtkmm/renddesc.cpp delete mode 100644 synfig-studio/src/gtkmm/renddesc.h delete mode 100644 synfig-studio/src/gtkmm/render.cpp delete mode 100644 synfig-studio/src/gtkmm/render.h delete mode 100644 synfig-studio/src/gtkmm/renderer_bbox.cpp delete mode 100644 synfig-studio/src/gtkmm/renderer_bbox.h delete mode 100644 synfig-studio/src/gtkmm/renderer_canvas.cpp delete mode 100644 synfig-studio/src/gtkmm/renderer_canvas.h delete mode 100644 synfig-studio/src/gtkmm/renderer_dragbox.cpp delete mode 100644 synfig-studio/src/gtkmm/renderer_dragbox.h delete mode 100644 synfig-studio/src/gtkmm/renderer_ducks.cpp delete mode 100644 synfig-studio/src/gtkmm/renderer_ducks.h delete mode 100644 synfig-studio/src/gtkmm/renderer_grid.cpp delete mode 100644 synfig-studio/src/gtkmm/renderer_grid.h delete mode 100644 synfig-studio/src/gtkmm/renderer_guides.cpp delete mode 100644 synfig-studio/src/gtkmm/renderer_guides.h delete mode 100644 synfig-studio/src/gtkmm/renderer_timecode.cpp delete mode 100644 synfig-studio/src/gtkmm/renderer_timecode.h delete mode 100644 synfig-studio/src/gtkmm/resolutiondial.cpp delete mode 100644 synfig-studio/src/gtkmm/resolutiondial.h delete mode 100644 synfig-studio/src/gtkmm/smach.h delete mode 100644 synfig-studio/src/gtkmm/splash.cpp delete mode 100644 synfig-studio/src/gtkmm/splash.h delete mode 100644 synfig-studio/src/gtkmm/state_bline.cpp delete mode 100644 synfig-studio/src/gtkmm/state_bline.h delete mode 100644 synfig-studio/src/gtkmm/state_circle.cpp delete mode 100644 synfig-studio/src/gtkmm/state_circle.h delete mode 100644 synfig-studio/src/gtkmm/state_draw.cpp delete mode 100644 synfig-studio/src/gtkmm/state_draw.h delete mode 100644 synfig-studio/src/gtkmm/state_eyedrop.cpp delete mode 100644 synfig-studio/src/gtkmm/state_eyedrop.h delete mode 100644 synfig-studio/src/gtkmm/state_fill.cpp delete mode 100644 synfig-studio/src/gtkmm/state_fill.h delete mode 100644 synfig-studio/src/gtkmm/state_gradient.cpp delete mode 100644 synfig-studio/src/gtkmm/state_gradient.h delete mode 100644 synfig-studio/src/gtkmm/state_normal.cpp delete mode 100644 synfig-studio/src/gtkmm/state_normal.h delete mode 100644 synfig-studio/src/gtkmm/state_polygon.cpp delete mode 100644 synfig-studio/src/gtkmm/state_polygon.h delete mode 100644 synfig-studio/src/gtkmm/state_rectangle.cpp delete mode 100644 synfig-studio/src/gtkmm/state_rectangle.h delete mode 100644 synfig-studio/src/gtkmm/state_rotate.cpp delete mode 100644 synfig-studio/src/gtkmm/state_rotate.h delete mode 100644 synfig-studio/src/gtkmm/state_scale.cpp delete mode 100644 synfig-studio/src/gtkmm/state_scale.h delete mode 100644 synfig-studio/src/gtkmm/state_sketch.cpp delete mode 100644 synfig-studio/src/gtkmm/state_sketch.h delete mode 100644 synfig-studio/src/gtkmm/state_smoothmove.cpp delete mode 100644 synfig-studio/src/gtkmm/state_smoothmove.h delete mode 100644 synfig-studio/src/gtkmm/state_star.cpp delete mode 100644 synfig-studio/src/gtkmm/state_star.h delete mode 100644 synfig-studio/src/gtkmm/state_stroke.cpp delete mode 100644 synfig-studio/src/gtkmm/state_stroke.h delete mode 100644 synfig-studio/src/gtkmm/state_text.cpp delete mode 100644 synfig-studio/src/gtkmm/state_text.h delete mode 100644 synfig-studio/src/gtkmm/state_width.cpp delete mode 100644 synfig-studio/src/gtkmm/state_width.h delete mode 100644 synfig-studio/src/gtkmm/state_zoom.cpp delete mode 100644 synfig-studio/src/gtkmm/state_zoom.h delete mode 100644 synfig-studio/src/gtkmm/statemanager.cpp delete mode 100644 synfig-studio/src/gtkmm/statemanager.h delete mode 100644 synfig-studio/src/gtkmm/toggleducksdial.cpp delete mode 100644 synfig-studio/src/gtkmm/toggleducksdial.h delete mode 100644 synfig-studio/src/gtkmm/toolbox.cpp delete mode 100644 synfig-studio/src/gtkmm/toolbox.h delete mode 100644 synfig-studio/src/gtkmm/valuelink.cpp delete mode 100644 synfig-studio/src/gtkmm/valuelink.h delete mode 100644 synfig-studio/src/gtkmm/widget_canvaschooser.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_canvaschooser.h delete mode 100644 synfig-studio/src/gtkmm/widget_color.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_color.h delete mode 100644 synfig-studio/src/gtkmm/widget_coloredit.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_coloredit.h delete mode 100644 synfig-studio/src/gtkmm/widget_compselect.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_compselect.h delete mode 100644 synfig-studio/src/gtkmm/widget_curves.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_curves.h delete mode 100644 synfig-studio/src/gtkmm/widget_defaults.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_defaults.h delete mode 100644 synfig-studio/src/gtkmm/widget_distance.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_distance.h delete mode 100644 synfig-studio/src/gtkmm/widget_enum.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_enum.h delete mode 100644 synfig-studio/src/gtkmm/widget_filename.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_filename.h delete mode 100644 synfig-studio/src/gtkmm/widget_gradient.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_gradient.h delete mode 100644 synfig-studio/src/gtkmm/widget_keyframe_list.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_keyframe_list.h delete mode 100644 synfig-studio/src/gtkmm/widget_sound.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_sound.h delete mode 100644 synfig-studio/src/gtkmm/widget_time.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_time.h delete mode 100644 synfig-studio/src/gtkmm/widget_timeslider.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_timeslider.h delete mode 100644 synfig-studio/src/gtkmm/widget_value.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_value.h delete mode 100644 synfig-studio/src/gtkmm/widget_vector.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_vector.h delete mode 100644 synfig-studio/src/gtkmm/widget_waypoint.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_waypoint.h delete mode 100644 synfig-studio/src/gtkmm/widget_waypointmodel.cpp delete mode 100644 synfig-studio/src/gtkmm/widget_waypointmodel.h delete mode 100644 synfig-studio/src/gtkmm/workarea.cpp delete mode 100644 synfig-studio/src/gtkmm/workarea.h delete mode 100644 synfig-studio/src/gtkmm/workarearenderer.cpp delete mode 100644 synfig-studio/src/gtkmm/workarearenderer.h delete mode 100644 synfig-studio/src/gtkmm/zoomdial.cpp delete mode 100644 synfig-studio/src/gtkmm/zoomdial.h create mode 100644 synfig-studio/src/gui/Makefile.am create mode 100644 synfig-studio/src/gui/about.cpp create mode 100644 synfig-studio/src/gui/about.h create mode 100644 synfig-studio/src/gui/adjust_window.cpp create mode 100644 synfig-studio/src/gui/adjust_window.h create mode 100644 synfig-studio/src/gui/app.cpp create mode 100644 synfig-studio/src/gui/app.h create mode 100644 synfig-studio/src/gui/asyncrenderer.cpp create mode 100644 synfig-studio/src/gui/asyncrenderer.h create mode 100644 synfig-studio/src/gui/audiocontainer.cpp create mode 100644 synfig-studio/src/gui/audiocontainer.h create mode 100644 synfig-studio/src/gui/autorecover.cpp create mode 100644 synfig-studio/src/gui/autorecover.h create mode 100644 synfig-studio/src/gui/canvasoptions.cpp create mode 100644 synfig-studio/src/gui/canvasoptions.h create mode 100644 synfig-studio/src/gui/canvasproperties.cpp create mode 100644 synfig-studio/src/gui/canvasproperties.h create mode 100644 synfig-studio/src/gui/canvastreestore.cpp create mode 100644 synfig-studio/src/gui/canvastreestore.h create mode 100644 synfig-studio/src/gui/canvasview.cpp create mode 100644 synfig-studio/src/gui/canvasview.h create mode 100644 synfig-studio/src/gui/cellrenderer_gradient.cpp create mode 100644 synfig-studio/src/gui/cellrenderer_gradient.h create mode 100644 synfig-studio/src/gui/cellrenderer_time.cpp create mode 100644 synfig-studio/src/gui/cellrenderer_time.h create mode 100644 synfig-studio/src/gui/cellrenderer_timetrack.cpp create mode 100644 synfig-studio/src/gui/cellrenderer_timetrack.h create mode 100644 synfig-studio/src/gui/cellrenderer_value.cpp create mode 100644 synfig-studio/src/gui/cellrenderer_value.h create mode 100644 synfig-studio/src/gui/childrentree.cpp create mode 100644 synfig-studio/src/gui/childrentree.h create mode 100644 synfig-studio/src/gui/childrentreestore.cpp create mode 100644 synfig-studio/src/gui/childrentreestore.h create mode 100644 synfig-studio/src/gui/compview.cpp create mode 100644 synfig-studio/src/gui/compview.h create mode 100644 synfig-studio/src/gui/devicetracker.cpp create mode 100644 synfig-studio/src/gui/devicetracker.h create mode 100644 synfig-studio/src/gui/dialog_color.cpp create mode 100644 synfig-studio/src/gui/dialog_color.h create mode 100644 synfig-studio/src/gui/dialog_gradient.cpp create mode 100644 synfig-studio/src/gui/dialog_gradient.h create mode 100644 synfig-studio/src/gui/dialog_keyframe.cpp create mode 100644 synfig-studio/src/gui/dialog_keyframe.h create mode 100644 synfig-studio/src/gui/dialog_preview.cpp create mode 100644 synfig-studio/src/gui/dialog_preview.h create mode 100644 synfig-studio/src/gui/dialog_setup.cpp create mode 100644 synfig-studio/src/gui/dialog_setup.h create mode 100644 synfig-studio/src/gui/dialog_soundselect.cpp create mode 100644 synfig-studio/src/gui/dialog_soundselect.h create mode 100644 synfig-studio/src/gui/dialog_targetparam.cpp create mode 100644 synfig-studio/src/gui/dialog_targetparam.h create mode 100644 synfig-studio/src/gui/dialog_tooloptions.cpp create mode 100644 synfig-studio/src/gui/dialog_tooloptions.h create mode 100644 synfig-studio/src/gui/dialog_waypoint.cpp create mode 100644 synfig-studio/src/gui/dialog_waypoint.h create mode 100644 synfig-studio/src/gui/dialogsettings.cpp create mode 100644 synfig-studio/src/gui/dialogsettings.h create mode 100644 synfig-studio/src/gui/dock_canvases.cpp create mode 100644 synfig-studio/src/gui/dock_canvases.h create mode 100644 synfig-studio/src/gui/dock_canvasspecific.cpp create mode 100644 synfig-studio/src/gui/dock_canvasspecific.h create mode 100644 synfig-studio/src/gui/dock_children.cpp create mode 100644 synfig-studio/src/gui/dock_children.h create mode 100644 synfig-studio/src/gui/dock_curves.cpp create mode 100644 synfig-studio/src/gui/dock_curves.h create mode 100644 synfig-studio/src/gui/dock_history.cpp create mode 100644 synfig-studio/src/gui/dock_history.h create mode 100644 synfig-studio/src/gui/dock_info.cpp create mode 100644 synfig-studio/src/gui/dock_info.h create mode 100644 synfig-studio/src/gui/dock_keyframes.cpp create mode 100644 synfig-studio/src/gui/dock_keyframes.h create mode 100644 synfig-studio/src/gui/dock_layergroups.cpp create mode 100644 synfig-studio/src/gui/dock_layergroups.h create mode 100644 synfig-studio/src/gui/dock_layers.cpp create mode 100644 synfig-studio/src/gui/dock_layers.h create mode 100644 synfig-studio/src/gui/dock_metadata.cpp create mode 100644 synfig-studio/src/gui/dock_metadata.h create mode 100644 synfig-studio/src/gui/dock_navigator.cpp create mode 100644 synfig-studio/src/gui/dock_navigator.h create mode 100644 synfig-studio/src/gui/dock_params.cpp create mode 100644 synfig-studio/src/gui/dock_params.h create mode 100644 synfig-studio/src/gui/dock_timetrack.cpp create mode 100644 synfig-studio/src/gui/dock_timetrack.h create mode 100644 synfig-studio/src/gui/dockable.cpp create mode 100644 synfig-studio/src/gui/dockable.h create mode 100644 synfig-studio/src/gui/dockbook.cpp create mode 100644 synfig-studio/src/gui/dockbook.h create mode 100644 synfig-studio/src/gui/dockdialog.cpp create mode 100644 synfig-studio/src/gui/dockdialog.h create mode 100644 synfig-studio/src/gui/dockmanager.cpp create mode 100644 synfig-studio/src/gui/dockmanager.h create mode 100644 synfig-studio/src/gui/duck.cpp create mode 100644 synfig-studio/src/gui/duck.h create mode 100644 synfig-studio/src/gui/duckmatic.cpp create mode 100644 synfig-studio/src/gui/duckmatic.h create mode 100644 synfig-studio/src/gui/ducktransform_rotate.h create mode 100644 synfig-studio/src/gui/ducktransform_scale.h create mode 100644 synfig-studio/src/gui/ducktransform_translate.h create mode 100644 synfig-studio/src/gui/event_layerclick.h create mode 100644 synfig-studio/src/gui/event_mouse.h create mode 100644 synfig-studio/src/gui/eventkey.h create mode 100644 synfig-studio/src/gui/framedial.cpp create mode 100644 synfig-studio/src/gui/framedial.h create mode 100644 synfig-studio/src/gui/general.h create mode 100644 synfig-studio/src/gui/groupactionmanager.cpp create mode 100644 synfig-studio/src/gui/groupactionmanager.h create mode 100644 synfig-studio/src/gui/historytreestore.cpp create mode 100644 synfig-studio/src/gui/historytreestore.h create mode 100644 synfig-studio/src/gui/iconcontroller.cpp create mode 100644 synfig-studio/src/gui/iconcontroller.h create mode 100644 synfig-studio/src/gui/instance.cpp create mode 100644 synfig-studio/src/gui/instance.h create mode 100644 synfig-studio/src/gui/ipc.cpp create mode 100644 synfig-studio/src/gui/ipc.h create mode 100644 synfig-studio/src/gui/keyframeactionmanager.cpp create mode 100644 synfig-studio/src/gui/keyframeactionmanager.h create mode 100644 synfig-studio/src/gui/keyframedial.cpp create mode 100644 synfig-studio/src/gui/keyframedial.h create mode 100644 synfig-studio/src/gui/keyframetree.cpp create mode 100644 synfig-studio/src/gui/keyframetree.h create mode 100644 synfig-studio/src/gui/keyframetreestore.cpp create mode 100644 synfig-studio/src/gui/keyframetreestore.h create mode 100644 synfig-studio/src/gui/keymapsettings.cpp create mode 100644 synfig-studio/src/gui/keymapsettings.h create mode 100644 synfig-studio/src/gui/layeractionmanager.cpp create mode 100644 synfig-studio/src/gui/layeractionmanager.h create mode 100644 synfig-studio/src/gui/layergrouptree.cpp create mode 100644 synfig-studio/src/gui/layergrouptree.h create mode 100644 synfig-studio/src/gui/layergrouptreestore.cpp create mode 100644 synfig-studio/src/gui/layergrouptreestore.h create mode 100644 synfig-studio/src/gui/layerparamtreestore.cpp create mode 100644 synfig-studio/src/gui/layerparamtreestore.h create mode 100644 synfig-studio/src/gui/layertree.cpp create mode 100644 synfig-studio/src/gui/layertree.h create mode 100644 synfig-studio/src/gui/layertreestore.cpp create mode 100644 synfig-studio/src/gui/layertreestore.h create mode 100644 synfig-studio/src/gui/main.cpp create mode 100644 synfig-studio/src/gui/metadatatreestore.cpp create mode 100644 synfig-studio/src/gui/metadatatreestore.h create mode 100644 synfig-studio/src/gui/mod_mirror/mod_mirror.cpp create mode 100644 synfig-studio/src/gui/mod_mirror/mod_mirror.h create mode 100644 synfig-studio/src/gui/mod_mirror/state_mirror.cpp create mode 100644 synfig-studio/src/gui/mod_mirror/state_mirror.h create mode 100644 synfig-studio/src/gui/mod_palette/dock_palbrowse.cpp create mode 100644 synfig-studio/src/gui/mod_palette/dock_palbrowse.h create mode 100644 synfig-studio/src/gui/mod_palette/dock_paledit.cpp create mode 100644 synfig-studio/src/gui/mod_palette/dock_paledit.h create mode 100644 synfig-studio/src/gui/mod_palette/mod_palette.cpp create mode 100644 synfig-studio/src/gui/mod_palette/mod_palette.h create mode 100644 synfig-studio/src/gui/module.cpp create mode 100644 synfig-studio/src/gui/module.h create mode 100644 synfig-studio/src/gui/onemoment.cpp create mode 100644 synfig-studio/src/gui/onemoment.h create mode 100644 synfig-studio/src/gui/preview.cpp create mode 100644 synfig-studio/src/gui/preview.h create mode 100644 synfig-studio/src/gui/renddesc.cpp create mode 100644 synfig-studio/src/gui/renddesc.h create mode 100644 synfig-studio/src/gui/render.cpp create mode 100644 synfig-studio/src/gui/render.h create mode 100644 synfig-studio/src/gui/renderer_bbox.cpp create mode 100644 synfig-studio/src/gui/renderer_bbox.h create mode 100644 synfig-studio/src/gui/renderer_canvas.cpp create mode 100644 synfig-studio/src/gui/renderer_canvas.h create mode 100644 synfig-studio/src/gui/renderer_dragbox.cpp create mode 100644 synfig-studio/src/gui/renderer_dragbox.h create mode 100644 synfig-studio/src/gui/renderer_ducks.cpp create mode 100644 synfig-studio/src/gui/renderer_ducks.h create mode 100644 synfig-studio/src/gui/renderer_grid.cpp create mode 100644 synfig-studio/src/gui/renderer_grid.h create mode 100644 synfig-studio/src/gui/renderer_guides.cpp create mode 100644 synfig-studio/src/gui/renderer_guides.h create mode 100644 synfig-studio/src/gui/renderer_timecode.cpp create mode 100644 synfig-studio/src/gui/renderer_timecode.h create mode 100644 synfig-studio/src/gui/resolutiondial.cpp create mode 100644 synfig-studio/src/gui/resolutiondial.h create mode 100644 synfig-studio/src/gui/smach.h create mode 100644 synfig-studio/src/gui/splash.cpp create mode 100644 synfig-studio/src/gui/splash.h create mode 100644 synfig-studio/src/gui/state_bline.cpp create mode 100644 synfig-studio/src/gui/state_bline.h create mode 100644 synfig-studio/src/gui/state_circle.cpp create mode 100644 synfig-studio/src/gui/state_circle.h create mode 100644 synfig-studio/src/gui/state_draw.cpp create mode 100644 synfig-studio/src/gui/state_draw.h create mode 100644 synfig-studio/src/gui/state_eyedrop.cpp create mode 100644 synfig-studio/src/gui/state_eyedrop.h create mode 100644 synfig-studio/src/gui/state_fill.cpp create mode 100644 synfig-studio/src/gui/state_fill.h create mode 100644 synfig-studio/src/gui/state_gradient.cpp create mode 100644 synfig-studio/src/gui/state_gradient.h create mode 100644 synfig-studio/src/gui/state_normal.cpp create mode 100644 synfig-studio/src/gui/state_normal.h create mode 100644 synfig-studio/src/gui/state_polygon.cpp create mode 100644 synfig-studio/src/gui/state_polygon.h create mode 100644 synfig-studio/src/gui/state_rectangle.cpp create mode 100644 synfig-studio/src/gui/state_rectangle.h create mode 100644 synfig-studio/src/gui/state_rotate.cpp create mode 100644 synfig-studio/src/gui/state_rotate.h create mode 100644 synfig-studio/src/gui/state_scale.cpp create mode 100644 synfig-studio/src/gui/state_scale.h create mode 100644 synfig-studio/src/gui/state_sketch.cpp create mode 100644 synfig-studio/src/gui/state_sketch.h create mode 100644 synfig-studio/src/gui/state_smoothmove.cpp create mode 100644 synfig-studio/src/gui/state_smoothmove.h create mode 100644 synfig-studio/src/gui/state_star.cpp create mode 100644 synfig-studio/src/gui/state_star.h create mode 100644 synfig-studio/src/gui/state_stroke.cpp create mode 100644 synfig-studio/src/gui/state_stroke.h create mode 100644 synfig-studio/src/gui/state_text.cpp create mode 100644 synfig-studio/src/gui/state_text.h create mode 100644 synfig-studio/src/gui/state_width.cpp create mode 100644 synfig-studio/src/gui/state_width.h create mode 100644 synfig-studio/src/gui/state_zoom.cpp create mode 100644 synfig-studio/src/gui/state_zoom.h create mode 100644 synfig-studio/src/gui/statemanager.cpp create mode 100644 synfig-studio/src/gui/statemanager.h create mode 100644 synfig-studio/src/gui/toggleducksdial.cpp create mode 100644 synfig-studio/src/gui/toggleducksdial.h create mode 100644 synfig-studio/src/gui/toolbox.cpp create mode 100644 synfig-studio/src/gui/toolbox.h create mode 100644 synfig-studio/src/gui/valuelink.cpp create mode 100644 synfig-studio/src/gui/valuelink.h create mode 100644 synfig-studio/src/gui/widget_canvaschooser.cpp create mode 100644 synfig-studio/src/gui/widget_canvaschooser.h create mode 100644 synfig-studio/src/gui/widget_color.cpp create mode 100644 synfig-studio/src/gui/widget_color.h create mode 100644 synfig-studio/src/gui/widget_coloredit.cpp create mode 100644 synfig-studio/src/gui/widget_coloredit.h create mode 100644 synfig-studio/src/gui/widget_compselect.cpp create mode 100644 synfig-studio/src/gui/widget_compselect.h create mode 100644 synfig-studio/src/gui/widget_curves.cpp create mode 100644 synfig-studio/src/gui/widget_curves.h create mode 100644 synfig-studio/src/gui/widget_defaults.cpp create mode 100644 synfig-studio/src/gui/widget_defaults.h create mode 100644 synfig-studio/src/gui/widget_distance.cpp create mode 100644 synfig-studio/src/gui/widget_distance.h create mode 100644 synfig-studio/src/gui/widget_enum.cpp create mode 100644 synfig-studio/src/gui/widget_enum.h create mode 100644 synfig-studio/src/gui/widget_filename.cpp create mode 100644 synfig-studio/src/gui/widget_filename.h create mode 100644 synfig-studio/src/gui/widget_gradient.cpp create mode 100644 synfig-studio/src/gui/widget_gradient.h create mode 100644 synfig-studio/src/gui/widget_keyframe_list.cpp create mode 100644 synfig-studio/src/gui/widget_keyframe_list.h create mode 100644 synfig-studio/src/gui/widget_sound.cpp create mode 100644 synfig-studio/src/gui/widget_sound.h create mode 100644 synfig-studio/src/gui/widget_time.cpp create mode 100644 synfig-studio/src/gui/widget_time.h create mode 100644 synfig-studio/src/gui/widget_timeslider.cpp create mode 100644 synfig-studio/src/gui/widget_timeslider.h create mode 100644 synfig-studio/src/gui/widget_value.cpp create mode 100644 synfig-studio/src/gui/widget_value.h create mode 100644 synfig-studio/src/gui/widget_vector.cpp create mode 100644 synfig-studio/src/gui/widget_vector.h create mode 100644 synfig-studio/src/gui/widget_waypoint.cpp create mode 100644 synfig-studio/src/gui/widget_waypoint.h create mode 100644 synfig-studio/src/gui/widget_waypointmodel.cpp create mode 100644 synfig-studio/src/gui/widget_waypointmodel.h create mode 100644 synfig-studio/src/gui/workarea.cpp create mode 100644 synfig-studio/src/gui/workarea.h create mode 100644 synfig-studio/src/gui/workarearenderer.cpp create mode 100644 synfig-studio/src/gui/workarearenderer.h create mode 100644 synfig-studio/src/gui/zoomdial.cpp create mode 100644 synfig-studio/src/gui/zoomdial.h diff --git a/synfig-studio/configure.ac b/synfig-studio/configure.ac index 0077290..704fd4e 100755 --- a/synfig-studio/configure.ac +++ b/synfig-studio/configure.ac @@ -275,7 +275,7 @@ synfigstudio.keys synfigstudio.xml synfigstudio-thumbnailer.schemas src/Makefile -src/gtkmm/Makefile +src/gui/Makefile src/synfigapp/Makefile images/Makefile win32inst.nsi diff --git a/synfig-studio/src/Makefile.am b/synfig-studio/src/Makefile.am index adc00c2..4bc8c6e 100644 --- a/synfig-studio/src/Makefile.am +++ b/synfig-studio/src/Makefile.am @@ -8,4 +8,4 @@ EXTRA_DIST = \ SUBDIRS = \ synfigapp \ - gtkmm + gui diff --git a/synfig-studio/src/gtkmm/Makefile.am b/synfig-studio/src/gtkmm/Makefile.am deleted file mode 100644 index 384a865..0000000 --- a/synfig-studio/src/gtkmm/Makefile.am +++ /dev/null @@ -1,387 +0,0 @@ -# $Id$ - -EXTRA_DIST = \ - compview.cpp - -MAINTAINERCLEANFILES = \ - Makefile.in - - -CELLRENDERER_HH = \ - cellrenderer_gradient.h \ - cellrenderer_time.h \ - cellrenderer_timetrack.h \ - cellrenderer_value.h - -CELLRENDERER_CC = \ - cellrenderer_gradient.cpp \ - cellrenderer_time.cpp \ - cellrenderer_timetrack.cpp \ - cellrenderer_value.cpp - - -WORKAREARENDERER_HH = \ - renderer_bbox.h \ - renderer_canvas.h \ - renderer_dragbox.h \ - renderer_ducks.h \ - renderer_grid.h \ - renderer_guides.h \ - renderer_timecode.h \ - workarearenderer.h - -WORKAREARENDERER_CC = \ - renderer_bbox.cpp \ - renderer_canvas.cpp \ - renderer_dragbox.cpp \ - renderer_ducks.cpp \ - renderer_grid.cpp \ - renderer_guides.cpp \ - renderer_timecode.cpp \ - workarearenderer.cpp - - -PALETTE_HH = \ - mod_palette/dock_palbrowse.h \ - mod_palette/dock_paledit.h \ - mod_palette/mod_palette.h - -PALETTE_CC = \ - mod_palette/dock_palbrowse.cpp \ - mod_palette/dock_paledit.cpp \ - mod_palette/mod_palette.cpp - - -MOD_MIRROR_HH = \ - mod_mirror/mod_mirror.h \ - mod_mirror/state_mirror.h - -MOD_MIRROR_CC = \ - mod_mirror/mod_mirror.cpp \ - mod_mirror/state_mirror.cpp - - -DIALOG_HH = \ - dialog_color.h \ - dialog_gradient.h \ - dialog_keyframe.h \ - dialog_preview.h \ - dialog_setup.h \ - dialog_soundselect.h \ - dialog_targetparam.h \ - dialog_waypoint.h - -DIALOG_CC = \ - dialog_color.cpp \ - dialog_gradient.cpp \ - dialog_keyframe.cpp \ - dialog_preview.cpp \ - dialog_setup.cpp \ - dialog_soundselect.cpp \ - dialog_targetparam.cpp \ - dialog_waypoint.cpp - - -DOCK_HH = \ - dialog_tooloptions.h \ - dock_canvases.h \ - dock_canvasspecific.h \ - dock_children.h \ - dock_curves.h \ - dock_history.h \ - dock_info.h \ - dock_keyframes.h \ - dock_layergroups.h \ - dock_layers.h \ - dock_metadata.h \ - dock_navigator.h \ - dock_params.h \ - dock_timetrack.h \ - dockable.h \ - dockbook.h \ - dockdialog.h \ - dockmanager.h - -DOCK_CC = \ - dialog_tooloptions.cpp \ - dock_canvases.cpp \ - dock_canvasspecific.cpp \ - dock_children.cpp \ - dock_curves.cpp \ - dock_history.cpp \ - dock_info.cpp \ - dock_keyframes.cpp \ - dock_layergroups.cpp \ - dock_layers.cpp \ - dock_metadata.cpp \ - dock_navigator.cpp \ - dock_params.cpp \ - dock_timetrack.cpp \ - dockable.cpp \ - dockbook.cpp \ - dockdialog.cpp \ - dockmanager.cpp - - -WIDGET_HH = \ - widget_canvaschooser.h \ - widget_color.h \ - widget_coloredit.h \ - widget_compselect.h \ - widget_curves.h \ - widget_defaults.h \ - widget_distance.h \ - widget_enum.h \ - widget_filename.h \ - widget_gradient.h \ - widget_sound.h \ - widget_time.h \ - widget_timeslider.h \ - widget_value.h \ - widget_vector.h \ - widget_waypoint.h \ - widget_waypointmodel.h \ - widget_keyframe_list.h - -WIDGET_CC = \ - widget_canvaschooser.cpp \ - widget_color.cpp \ - widget_coloredit.cpp \ - widget_compselect.cpp \ - widget_curves.cpp \ - widget_defaults.cpp \ - widget_distance.cpp \ - widget_enum.cpp \ - widget_filename.cpp \ - widget_gradient.cpp \ - widget_sound.cpp \ - widget_time.cpp \ - widget_timeslider.cpp \ - widget_value.cpp \ - widget_vector.cpp \ - widget_waypoint.cpp \ - widget_waypointmodel.cpp \ - widget_keyframe_list.cpp - - -STATE_HH = \ - state_bline.h \ - state_circle.h \ - state_draw.h \ - state_eyedrop.h \ - state_fill.h \ - state_gradient.h \ - state_normal.h \ - state_polygon.h \ - state_rectangle.h \ - state_rotate.h \ - state_scale.h \ - state_sketch.h \ - state_smoothmove.h \ - state_star.h \ - state_stroke.h \ - state_text.h \ - state_width.h \ - state_zoom.h - -STATE_CC = \ - state_bline.cpp \ - state_circle.cpp \ - state_draw.cpp \ - state_eyedrop.cpp \ - state_fill.cpp \ - state_gradient.cpp \ - state_normal.cpp \ - state_polygon.cpp \ - state_rectangle.cpp \ - state_rotate.cpp \ - state_scale.cpp \ - state_sketch.cpp \ - state_smoothmove.cpp \ - state_star.cpp \ - state_stroke.cpp \ - state_text.cpp \ - state_width.cpp \ - state_zoom.cpp - - -TREEVIEW_HH = \ - childrentree.h \ - keyframetree.h \ - layergrouptree.h \ - layertree.h - -TREEVIEW_CC = \ - childrentree.cpp \ - keyframetree.cpp \ - layergrouptree.cpp \ - layertree.cpp - - -TREESTORE_HH = \ - canvastreestore.h \ - childrentreestore.h \ - historytreestore.h \ - keyframetreestore.h \ - layergrouptreestore.h \ - layerparamtreestore.h \ - layertreestore.h \ - metadatatreestore.h - -TREESTORE_CC = \ - canvastreestore.cpp \ - childrentreestore.cpp \ - historytreestore.cpp \ - keyframetreestore.cpp \ - layergrouptreestore.cpp \ - layerparamtreestore.cpp \ - layertreestore.cpp \ - metadatatreestore.cpp - - -DUCKTRANSFORM_HH = \ - ducktransform_rotate.h \ - ducktransform_scale.h \ - ducktransform_translate.h \ - duck.h - -DUCKTRANSFORM_CC = \ - duck.cpp - - -EVENTS_HH = \ - event_layerclick.h \ - event_mouse.h - - -ACTION_MANAGERS_HH = \ - groupactionmanager.h \ - keyframeactionmanager.h \ - layeractionmanager.h - -ACTION_MANAGERS_CC = \ - groupactionmanager.cpp \ - keyframeactionmanager.cpp \ - layeractionmanager.cpp - - -OTHER_HH = \ - compview.h \ - eventkey.h \ - smach.h \ - about.h \ - adjust_window.h \ - app.h \ - asyncrenderer.h \ - audiocontainer.h \ - autorecover.h \ - canvasoptions.h \ - canvasproperties.h \ - canvasview.h \ - devicetracker.h \ - dialogsettings.h \ - duckmatic.h \ - general.h \ - iconcontroller.h \ - instance.h \ - ipc.h \ - keymapsettings.h \ - module.h \ - onemoment.h \ - preview.h \ - renddesc.h \ - render.h \ - splash.h \ - statemanager.h \ - toolbox.h \ - valuelink.h \ - workarea.h \ - zoomdial.h \ - framedial.h \ - keyframedial.h \ - toggleducksdial.h \ - resolutiondial.h - -OTHER_CC = \ - main.cpp \ - about.cpp \ - adjust_window.cpp \ - app.cpp \ - asyncrenderer.cpp \ - audiocontainer.cpp \ - autorecover.cpp \ - canvasoptions.cpp \ - canvasproperties.cpp \ - canvasview.cpp \ - devicetracker.cpp \ - dialogsettings.cpp \ - duckmatic.cpp \ - iconcontroller.cpp \ - instance.cpp \ - ipc.cpp \ - keymapsettings.cpp \ - module.cpp \ - onemoment.cpp \ - preview.cpp \ - renddesc.cpp \ - render.cpp \ - splash.cpp \ - statemanager.cpp \ - toolbox.cpp \ - valuelink.cpp \ - workarea.cpp \ - zoomdial.cpp \ - framedial.cpp \ - keyframedial.cpp \ - toggleducksdial.cpp \ - resolutiondial.cpp - -INCLUDES = \ - -I$(top_srcdir)/src - -bin_PROGRAMS = synfigstudio - -synfigstudio_SOURCES = \ - $(MOD_MIRROR_CC) \ - $(MOD_MIRROR_HH) \ - $(PALETTE_CC) \ - $(PALETTE_HH) \ - $(WORKAREARENDERER_CC) \ - $(WORKAREARENDERER_HH) \ - $(ACTION_MANAGERS_HH) \ - $(ACTION_MANAGERS_CC) \ - $(DOCK_HH) \ - $(DOCK_CC) \ - $(OTHER_HH) \ - $(OTHER_CC) \ - $(EVENTS_HH) \ - $(DUCKTRANSFORM_HH) \ - $(DUCKTRANSFORM_CC) \ - $(TREEVIEW_HH) \ - $(TREEVIEW_CC) \ - $(TREESTORE_HH) \ - $(TREESTORE_CC) \ - $(STATE_CC) \ - $(STATE_HH) \ - $(WIDGET_CC) \ - $(WIDGET_HH) \ - $(CELLRENDERER_HH) \ - $(CELLRENDERER_CC) \ - $(DIALOG_HH) \ - $(DIALOG_CC) - -synfigstudio_LDADD = \ - ../synfigapp/libsynfigapp.la \ - @SYNFIG_LIBS@ \ - @GTKMM_LIBS@ \ - @FMOD_LIBS@ - -synfigstudio_LDFLAGS = \ - -dlopen self - -synfigstudio_CXXFLAGS = \ - @SYNFIG_CFLAGS@ \ - @GTKMM_CFLAGS@ \ - -DIMAGE_DIR=\"$(imagedir)\" \ - -DIMAGE_EXT=\"$(imageext)\" \ - "-DLOCALEDIR=\"$(localedir)\"" diff --git a/synfig-studio/src/gtkmm/about.cpp b/synfig-studio/src/gtkmm/about.cpp deleted file mode 100644 index 600d135..0000000 --- a/synfig-studio/src/gtkmm/about.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file about.cpp -** \brief About dialog implementation -** -** $Id$ -** -** \legal -** Copyright (c) 2008 Paul Wise -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include - -#include - -#include - -#include - -// This is generated at make time from .svn or .git/svn or autorevision.conf -#include - -#include "about.h" -#include "app.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -#ifndef VERSION -#define VERSION "unknown" -#define PACKAGE "synfigstudio" -#endif - -#ifdef WIN32 -# ifdef IMAGE_DIR -# undef IMAGE_DIR -# define IMAGE_DIR "share\\pixmaps" -# endif -#endif - -#ifndef IMAGE_DIR -# define IMAGE_DIR "/usr/local/share/pixmaps" -#endif - -#ifndef IMAGE_EXT -# define IMAGE_EXT "png" -#endif - -#define stringify_(x) #x -#define stringify(x) stringify_(x) - -/* === G L O B A L S ======================================================= */ - -extern const guint gtk_major_version; -extern const guint gtk_minor_version; -extern const guint gtk_micro_version; -extern const guint gtk_binary_age; -extern const guint gtk_interface_age; - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -About::About() -{ - -#ifdef HAVE_GTK_ABOUTDIALOG_SET_PROGRAM_NAME - set_program_name(PACKAGE_NAME); -#else - set_name(PACKAGE_NAME); -#endif - set_version(VERSION); - set_comments(_("2D vector animation studio")); - - set_url_hook(sigc::mem_fun(*this, &About::on_link_clicked)); - set_website("http://www.synfig.org/"); - set_website_label(_("Visit the Synfig website")); - - set_copyright(_("Copyright 2001-2008\nRobert B. Quattlebaum Jr.,\nAdrian Bentley and Synfig contributors")); - Glib::ustring license = - "This program is free software; you can redistribute it and/or modify " - "it under the terms of the GNU General Public License as published by " - "the Free Software Foundation; either version 2 of the License, or " - "(at your option) any later version.\n\n" - - "This program is distributed in the hope that it will be useful, " - "but WITHOUT ANY WARRANTY; without even the implied warranty of " - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " - "GNU General Public License for more details.\n\n" - - "You should have received a copy of the GNU General Public License along " - "with this program; if not, write to the Free Software Foundation, Inc., " - "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or visit: http://www.gnu.org/"; - set_license(license); -#ifdef HAVE_GTK_ABOUTDIALOG_SET_WRAP_LICENSE - set_wrap_license(true); -#endif - - std::vector authors; - authors.push_back(_("Original developers:")); - authors.push_back(""); - authors.push_back("Robert B. Quattlebaum Jr (darco)"); - authors.push_back("Adrian Bentley"); - authors.push_back(""); - authors.push_back(_("Contributors:")); - authors.push_back(""); - authors.push_back("Adrian Winchell (SnapSilverlight)"); - authors.push_back("Andreas Jochens"); - authors.push_back("Carlos López González (genete)"); - authors.push_back("Carlos A. Sosa Navarro"); - authors.push_back("Chris Moore (dooglus)"); - authors.push_back("Chris Norman (pixelgeek)"); - authors.push_back("Cyril Brulebois (KiBi)"); - authors.push_back("Daniel Fort"); - authors.push_back("Daniel Hornung (rubikcube)"); - authors.push_back("David Roden (Bombe)"); - authors.push_back("Dmitriy Pomerantsev (Atrus)"); - authors.push_back("Douglas Lau"); - authors.push_back("Gerald Young (Yoyobuae)"); - authors.push_back("Gerco Ballintijn"); - authors.push_back("IL'dar AKHmetgaleev (AkhIL)"); - authors.push_back("Konstantin Dmitriev (zelgadis)"); - authors.push_back("Luka Pravica"); - authors.push_back("Martin Michlmayr (tbm)"); - authors.push_back("Miguel Gea Milvaques (xerakko)"); - authors.push_back("Paul Wise (pabs)"); - authors.push_back("Ralf Corsepius"); - authors.push_back("Ray Frederikson"); - authors.push_back("Timo Paulssen (timonator)"); - authors.push_back("Yue Shi Lai"); - set_authors(authors); - - std::vector artists; - artists.push_back("Aurore D (rore)"); - artists.push_back("Carlos López González (genete)"); - artists.push_back("Chris Norman (pixelgeek)"); - artists.push_back("Daniel Hornung (rubikcube)"); - artists.push_back("David Rylander (rylleman)"); - artists.push_back("Franco Iacomella (Yaco)"); - artists.push_back("Gerald Young (Yoyobuae)"); - artists.push_back("Henrique Lopes Barone"); - artists.push_back("Robert B. Quattlebaum Jr. (darco)"); - - set_artists(artists); - - // TRANSLATORS: change this to your name, separate multiple names with \n - set_translator_credits(_("translator-credits")); - - std::string imagepath; -#ifdef WIN32 - imagepath=App::get_base_path()+ETL_DIRECTORY_SEPARATOR+IMAGE_DIR; -#else - imagepath=IMAGE_DIR; -#endif - char* synfig_root=getenv("SYNFIG_ROOT"); - if(synfig_root) { - imagepath=synfig_root; - imagepath+=ETL_DIRECTORY_SEPARATOR; - imagepath+="share"; - imagepath+=ETL_DIRECTORY_SEPARATOR; - imagepath+="pixmaps"; - } - imagepath+=ETL_DIRECTORY_SEPARATOR; - - Gtk::Image *Logo = manage(new class Gtk::Image()); - Logo->set(imagepath+"synfig_icon."IMAGE_EXT); - set_logo(Logo->get_pixbuf()); - -#ifdef SHOW_EXTRA_INFO - - string extra_info = get_comments() + "\n"; - - #ifdef DEVEL_VERSION - extra_info += strprintf(_("\nDevelopment version:\n%s\n"),DEVEL_VERSION); - #endif - - extra_info += "\n"; - - extra_info += strprintf(_("Built on %s" /* at %s */ "\n"), __DATE__ /* , __TIME__ */ ); - - extra_info += "\n"; - - extra_info += strprintf(_("Built with:\n"), ETL_VERSION); - extra_info += strprintf(_("ETL %s\n"), ETL_VERSION); - extra_info += strprintf(_("Synfig API %s\n"), stringify(SYNFIG_VERSION)); - extra_info += strprintf(_("Synfig library %d\n"), SYNFIG_LIBRARY_VERSION); - extra_info += strprintf(_("GTK+ %d.%d.%d\n"), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); - #ifdef __GNUC__ - extra_info += strprintf(_("GNU G++ %d.%d.%d\n"),__GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__); - #endif - - extra_info += "\n"; - - extra_info += strprintf(_("Using:\n"), synfig::get_version()); - extra_info += strprintf(_("Synfig %s\n"), synfig::get_version()); - extra_info += strprintf(_("GTK+ %d.%d.%d"),gtk_major_version,gtk_minor_version,gtk_micro_version); - - #ifdef _DEBUG - extra_info += "\n\nDEBUG BUILD"; - #endif - - set_comments(extra_info); - -#endif - - // Hide the dialog when you click close - signal_response().connect(sigc::mem_fun(*this, &About::close)); -} - -void About::close(int){ - hide(); -} - -void About::on_link_clicked(Gtk::AboutDialog&, const Glib::ustring &url) -{ - App::open_url(url); -} diff --git a/synfig-studio/src/gtkmm/about.h b/synfig-studio/src/gtkmm/about.h deleted file mode 100644 index f00a773..0000000 --- a/synfig-studio/src/gtkmm/about.h +++ /dev/null @@ -1,55 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file about.h -** \brief About dialog class -** -** $Id$ -** -** \legal -** Copyright (c) 2008 Paul Wise -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_GTKMM_ABOUT_H -#define __SYNFIG_GTKMM_ABOUT_H - -/* === H E A D E R S ======================================================= */ - -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -# - -namespace studio { - -class About : public Gtk::AboutDialog -{ -public: - - About(); - void close(int); - void on_link_clicked(Gtk::AboutDialog&, const Glib::ustring &url); -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/adjust_window.cpp b/synfig-studio/src/gtkmm/adjust_window.cpp deleted file mode 100644 index 0b62737..0000000 --- a/synfig-studio/src/gtkmm/adjust_window.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file adjust_window.cpp -** \brief Adjustment Window Implementation File -** -** $Id$ -** -** \legal -** Copyright (c) 2004 Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "adjust_window.h" -#include "app.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -//using namespace etl; -//using namespace synfig; - -using studio::Adjust_Window; - -/* === M A C R O S ========================================================= */ -const double EPSILON = 1.0e-6; - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -/* === E N T R Y P O I N T ================================================= */ - -Adjust_Window::Adjust_Window(double value, double lower, double upper, - double stepinc, double pageinc, double pagesize, - Gtk::Adjustment *adj) -: Adjustment(value,lower,upper,stepinc,pageinc,pagesize), - adj_child(0) -{ - if(adj) set_child_adjustment(adj); -} - -Adjust_Window::~Adjust_Window() -{ - //connections should automatically be killed etc. -} - -//child interface functions -Gtk::Adjustment *Adjust_Window::get_child_adjustment() -{ - return adj_child; -} - -const Gtk::Adjustment *Adjust_Window::get_child_adjustment() const -{ - return adj_child; -} - -void Adjust_Window::set_child_adjustment(Gtk::Adjustment *child) -{ - childchanged.disconnect(); - - adj_child = child; - - // synfig::info("Adjust: connecting to child signals"); - - if(child) - { - childchanged = child->signal_changed().connect(sigc::mem_fun(*this,&Adjust_Window::update_fromchild)); - - update_child(); - } -} - -void Adjust_Window::on_changed() -{ - update_child(); -} - -void Adjust_Window::on_value_changed() -{ - update_child(); -} - -//SUB TIME FUNCTIONS -double Adjust_Window::get_sub_lower() const -{ - return get_value(); -} - -double Adjust_Window::get_sub_upper() const -{ - return get_value() + get_page_size(); -} - -//---- REFRESH FUNCTIONS ----- -void Adjust_Window::update_child() -{ - if(adj_child) - { - bool childchanged = false; - - double v = get_value(); - double ve = v + get_page_size(); - - //reset child's values if they need to be... - if(abs(v - adj_child->get_lower()) > EPSILON) - { - adj_child->set_lower(v); - childchanged = true; - } - - if(abs(ve - adj_child->get_upper()) > EPSILON) - { - adj_child->set_upper(ve); - childchanged = true; - } - - if(childchanged) - { - adj_child->changed(); - } - } -} - -void Adjust_Window::update_fromchild() -{ - if(adj_child) - { - double b = adj_child->get_lower(); - double dist = adj_child->get_upper() - b; - - //reset our values if they need to be... - if(abs(get_value() - b) > EPSILON) - { - set_value(b); - value_changed(); - } - - if(abs(get_page_size() - dist) > EPSILON) - { - set_page_size(dist); - changed(); - } - } -} diff --git a/synfig-studio/src/gtkmm/adjust_window.h b/synfig-studio/src/gtkmm/adjust_window.h deleted file mode 100644 index d1b57c3..0000000 --- a/synfig-studio/src/gtkmm/adjust_window.h +++ /dev/null @@ -1,94 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file adjust_window.h -** \brief Adjustment Window Header -** -** $Id$ -** -** \legal -** Copyright (c) 2004 Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_TEMPLATE_H -#define __SYNFIG_TEMPLATE_H - -/* === H E A D E R S ======================================================= */ -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio { - -/* Sets up an adjustment that controls/communicates with another adjustment - (could be expanded to multiple children) - - The current value and pagesize define the lower and upper bounds of the - child adjustment. - - NEED TO REPLACE FUNCTIONALITY IN: - refresh_rend_desc - refresh_time_window - on_time_changed - possibly.... - - time_zoom_in - possibly... - time_zoom_out - possibly... - - play - possibly... - - THINGS TO CHECK: - disp_audio's use of time_adjustment - children_tree's use of time_adjustment - layer_tree's use of time_adjustment -*/ -class Adjust_Window : public Gtk::Adjustment -{ - Gtk::Adjustment *adj_child; - - sigc::connection childchanged; //we only care about the non-value parts of the child - - virtual void on_changed(); //value+pagesize corresponds to child upper - virtual void on_value_changed(); //value corresponds to child lower - -protected: //update interface - virtual void update_child(); - virtual void update_fromchild(); - -public: //structors - Adjust_Window(double value, double lower, double upper, - double step_increment=1, double page_increment=10, double page_size=0, - Gtk::Adjustment *adj = 0); - - virtual ~Adjust_Window(); - -public: //child interface - Gtk::Adjustment *get_child_adjustment(); - const Gtk::Adjustment *get_child_adjustment() const; - void set_child_adjustment(Gtk::Adjustment *child); - -public: //Sub value interface - double get_sub_lower() const; - double get_sub_upper() const; -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/app.cpp b/synfig-studio/src/gtkmm/app.cpp deleted file mode 100644 index 01a4f8f..0000000 --- a/synfig-studio/src/gtkmm/app.cpp +++ /dev/null @@ -1,2515 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file app.cpp -** \brief writeme -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007, 2008 Chris Moore -** Copyright (c) 2008 Gerald Young -** Copyright (c) 2008 Carlos López -** Copyright (c) 2009 Nikita Kitaev -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef WIN32 -#define WINVER 0x0500 -#include -#endif - -#include -#include -#include -#include - -#ifdef HAVE_SYS_ERRNO_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -#include "app.h" -#include "about.h" -#include "splash.h" -#include "instance.h" -#include "canvasview.h" -#include "dialog_setup.h" -#include "dialog_gradient.h" -#include "dialog_color.h" -#include "toolbox.h" -#include "onemoment.h" - -#include "dockmanager.h" - -#include "state_eyedrop.h" -#include "state_normal.h" -#include "state_draw.h" -#include "state_fill.h" -#include "state_bline.h" -#include "state_polygon.h" -#include "state_sketch.h" -#include "state_gradient.h" -#include "state_circle.h" -#include "state_rectangle.h" -#include "state_smoothmove.h" -#include "state_scale.h" -#include "state_star.h" -#include "state_text.h" -#include "state_width.h" -#include "state_rotate.h" -#include "state_zoom.h" - -#include "devicetracker.h" -#include "dialog_tooloptions.h" -#include "widget_enum.h" - -#include "autorecover.h" - -#include -#include "dock_history.h" -#include "dock_canvases.h" -#include "dock_keyframes.h" -#include "dock_layers.h" -#include "dock_params.h" -#include "dock_metadata.h" -#include "dock_children.h" -#include "dock_info.h" -#include "dock_navigator.h" -#include "dock_layergroups.h" -#include "dock_timetrack.h" -#include "dock_curves.h" - -#include "mod_palette/mod_palette.h" -#include "mod_mirror/mod_mirror.h" - -#include - -#include "ipc.h" - -#include "module.h" - -#include "statemanager.h" - -#ifdef WITH_FMOD -#include -#endif - -#include -#include -#include - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -#ifndef SYNFIG_USER_APP_DIR -#ifdef __APPLE__ -#define SYNFIG_USER_APP_DIR "Library/Synfig" -#elif defined(_WIN32) -#define SYNFIG_USER_APP_DIR "Synfig" -#else -#define SYNFIG_USER_APP_DIR ".synfig" -#endif -#endif - -#ifndef DPM2DPI -#define DPM2DPI(x) (float(x)/39.3700787402f) -#define DPI2DPM(x) (float(x)*39.3700787402f) -#endif - -#ifdef WIN32 -# ifdef IMAGE_DIR -# undef IMAGE_DIR -# define IMAGE_DIR "share\\pixmaps" -# endif -#endif - -#ifndef IMAGE_DIR -# define IMAGE_DIR "/usr/local/share/pixmaps" -#endif - -#ifndef IMAGE_EXT -# define IMAGE_EXT "tif" -#endif - -#include - -/* === S I G N A L S ======================================================= */ - -static sigc::signal signal_present_all_; -sigc::signal& -App::signal_present_all() { return signal_present_all_; } - -static sigc::signal signal_recent_files_changed_; -sigc::signal& -App::signal_recent_files_changed() { return signal_recent_files_changed_; } - -static sigc::signal > signal_canvas_view_focus_; -sigc::signal >& -App::signal_canvas_view_focus() { return signal_canvas_view_focus_; } - -static sigc::signal > signal_instance_selected_; -sigc::signal >& -App::signal_instance_selected() { return signal_instance_selected_; } - -static sigc::signal > signal_instance_created_; -sigc::signal >& -App::signal_instance_created() { return signal_instance_created_; } - -static sigc::signal > signal_instance_deleted_; -sigc::signal >& -App::signal_instance_deleted() { return signal_instance_deleted_; } - -/* === G L O B A L S ======================================================= */ - -static std::list recent_files; -const std::list& App::get_recent_files() { return recent_files; } - -static std::list recent_files_window_size; - -int App::Busy::count; -bool App::shutdown_in_progress; - -synfig::Gamma App::gamma; - -Glib::RefPtr App::ui_manager_; - -synfig::Distance::System App::distance_system; - -studio::Dialog_Setup* App::dialog_setup; - -etl::handle< studio::ModPalette > mod_palette_; -//studio::Dialog_Palette* App::dialog_palette; - -std::list > App::instance_list; - -static etl::handle ui_interface_; -const etl::handle& App::get_ui_interface() { return ui_interface_; } - -etl::handle App::selected_instance; -etl::handle App::selected_canvas_view; - -studio::About *studio::App::about=NULL; - -studio::Toolbox *studio::App::toolbox=NULL; - -studio::AutoRecover *studio::App::auto_recover=NULL; - -studio::IPC *ipc=NULL; - -studio::DockManager* studio::App::dock_manager=0; - -studio::DeviceTracker* studio::App::device_tracker=0; - -studio::Dialog_Gradient* studio::App::dialog_gradient; - -studio::Dialog_Color* studio::App::dialog_color; - -Gtk::InputDialog* studio::App::dialog_input; - -studio::Dialog_ToolOptions* studio::App::dialog_tool_options; - -studio::Dock_History* dock_history; -studio::Dock_Canvases* dock_canvases; -studio::Dock_Keyframes* dock_keyframes; -studio::Dock_Layers* dock_layers; -studio::Dock_Params* dock_params; -studio::Dock_MetaData* dock_meta_data; -studio::Dock_Children* dock_children; -studio::Dock_Info* dock_info; -studio::Dock_LayerGroups* dock_layer_groups; -studio::Dock_Navigator* dock_navigator; -studio::Dock_Timetrack* dock_timetrack; -studio::Dock_Curves* dock_curves; - -std::list< etl::handle< studio::Module > > module_list_; - -bool studio::App::use_colorspace_gamma=true; -#ifdef SINGLE_THREADED -bool studio::App::single_threaded=false; -#endif -bool studio::App::restrict_radius_ducks=false; -bool studio::App::resize_imported_images=false; -String studio::App::custom_filename_prefix(DEFAULT_FILENAME_PREFIX); -int studio::App::preferred_x_size=480; -int studio::App::preferred_y_size=270; -String studio::App::predefined_size(DEFAULT_PREDEFINED_SIZE); -String studio::App::predefined_fps(DEFAULT_PREDEFINED_FPS); -float studio::App::preferred_fps=24.0; -#ifdef USE_OPEN_FOR_URLS -String studio::App::browser_command("open"); // MacOS only -#else -String studio::App::browser_command("xdg-open"); // Linux XDG standard -#endif - -static int max_recent_files_=25; -int studio::App::get_max_recent_files() { return max_recent_files_; } -void studio::App::set_max_recent_files(int x) { max_recent_files_=x; } - -static synfig::String app_base_path_; - -namespace studio { - -bool -really_delete_widget(Gtk::Widget *widget) -{ - // synfig::info("really delete %p", (void*)widget); - delete widget; - return false; -} - -// nasty workaround - when we've finished with a popup menu, we want to delete it -// attaching to the signal_hide() signal gets us here before the action on the menu has run, -// so schedule the real delete to happen in 50ms, giving the action a chance to run -void -delete_widget(Gtk::Widget *widget) -{ - // synfig::info("delete %p", (void*)widget); - Glib::signal_timeout().connect(sigc::bind(sigc::ptr_fun(&really_delete_widget), widget), 50); -} - -}; // END of namespace studio -studio::StateManager* state_manager; - - - - -class GlobalUIInterface : public synfigapp::UIInterface -{ -public: - - virtual Response confirmation(const std::string &title, - const std::string &primaryText, - const std::string &secondaryText, - const std::string &confirmPhrase, - const std::string &cancelPhrase, - Response defaultResponse) - { - Gtk::MessageDialog dialog( - primaryText, // Message - false, // Markup - Gtk::MESSAGE_WARNING, // Type - Gtk::BUTTONS_NONE, // Buttons - true // Modal - ); - - if (! title.empty()) - dialog.set_title(title); - if (! secondaryText.empty()) - dialog.set_secondary_text(secondaryText); - - dialog.add_button(cancelPhrase, RESPONSE_CANCEL); - dialog.add_button(confirmPhrase, RESPONSE_OK); - dialog.set_default_response(defaultResponse); - - dialog.show_all(); - return (Response) dialog.run(); - } - - virtual Response yes_no(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES) - { - Gtk::Dialog dialog( - title, // Title - true, // Modal - true // use_separator - ); - Gtk::Label label(message); - label.show(); - - dialog.get_vbox()->pack_start(label); - dialog.add_button(Gtk::StockID("gtk-yes"),RESPONSE_YES); - dialog.add_button(Gtk::StockID("gtk-no"),RESPONSE_NO); - - dialog.set_default_response(dflt); - dialog.show(); - return (Response)dialog.run(); - } - virtual Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES) - { - Gtk::Dialog dialog( - title, // Title - true, // Modal - true // use_separator - ); - Gtk::Label label(message); - label.show(); - - dialog.get_vbox()->pack_start(label); - dialog.add_button(Gtk::StockID("gtk-yes"),RESPONSE_YES); - dialog.add_button(Gtk::StockID("gtk-no"),RESPONSE_NO); - dialog.add_button(Gtk::StockID("gtk-cancel"),RESPONSE_CANCEL); - - dialog.set_default_response(dflt); - dialog.show(); - return (Response)dialog.run(); - } - virtual Response ok_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_OK) - { - Gtk::Dialog dialog( - title, // Title - true, // Modal - true // use_separator - ); - Gtk::Label label(message); - label.show(); - - dialog.get_vbox()->pack_start(label); - dialog.add_button(Gtk::StockID("gtk-ok"),RESPONSE_OK); - dialog.add_button(Gtk::StockID("gtk-cancel"),RESPONSE_CANCEL); - - dialog.set_default_response(dflt); - dialog.show(); - return (Response)dialog.run(); - } - - virtual bool - task(const std::string &task) - { - std::cerr<& action_group, int pos) -{ - action_group_list.push_back(action_group); - Gtk::UIManager::insert_action_group(action_group, pos); -} - -void -studio::UIManager::remove_action_group (const Glib::RefPtr& action_group) -{ - std::list >::iterator iter; - for(iter=action_group_list.begin();iter!=action_group_list.end();++iter) - if(*iter==action_group) - { - action_group_list.erase(iter); - Gtk::UIManager::remove_action_group(action_group); - return; - } - synfig::error("Unable to find action group"); -} - -void -studio::add_action_group_to_top(Glib::RefPtr ui_manager, Glib::RefPtr group) -{ - ui_manager->insert_action_group(group,0); - return; - std::list > prev_groups(ui_manager->get_action_groups()); - std::list >::reverse_iterator iter; - - for(iter=prev_groups.rbegin();iter!=prev_groups.rend();++iter) - { - if(*iter && (*iter)->get_name()!="menus") - { - synfig::info("Removing action group "+(*iter)->get_name()); - ui_manager->remove_action_group(*iter); - } - } - ui_manager->insert_action_group(group,0); - - for(;!prev_groups.empty();prev_groups.pop_front()) - { - if(prev_groups.front() && prev_groups.front()!=group && prev_groups.front()->get_name()!="menus") - ui_manager->insert_action_group(prev_groups.front(),1); - } -} -*/ -class Preferences : public synfigapp::Settings -{ -public: - virtual bool get_value(const synfig::String& key, synfig::String& value)const - { - if(key=="gamma") - { - value=strprintf("%f %f %f %f", - App::gamma.get_gamma_r(), - App::gamma.get_gamma_g(), - App::gamma.get_gamma_b(), - App::gamma.get_black_level() - ); - return true; - } - if(key=="time_format") - { - value=strprintf("%i",App::get_time_format()); - return true; - } - if(key=="file_history.size") - { - value=strprintf("%i",App::get_max_recent_files()); - return true; - } - if(key=="use_colorspace_gamma") - { - value=strprintf("%i",(int)App::use_colorspace_gamma); - return true; - } - if(key=="distance_system") - { - value=strprintf("%s",Distance::system_name(App::distance_system).c_str()); - return true; - } -#ifdef SINGLE_THREADED - if(key=="single_threaded") - { - value=strprintf("%i",(int)App::single_threaded); - return true; - } -#endif - if(key=="auto_recover_backup_interval") - { - value=strprintf("%i",App::auto_recover->get_timeout()); - return true; - } - if(key=="restrict_radius_ducks") - { - value=strprintf("%i",(int)App::restrict_radius_ducks); - return true; - } - if(key=="resize_imported_images") - { - value=strprintf("%i",(int)App::resize_imported_images); - return true; - } - if(key=="browser_command") - { - value=App::browser_command; - return true; - } - if(key=="custom_filename_prefix") - { - value=App::custom_filename_prefix; - return true; - } - if(key=="preferred_x_size") - { - value=strprintf("%i",App::preferred_x_size); - return true; - } - if(key=="preferred_y_size") - { - value=strprintf("%i",App::preferred_y_size); - return true; - } - if(key=="predefined_size") - { - value=strprintf("%s",App::predefined_size.c_str()); - return true; - } - if(key=="preferred_fps") - { - value=strprintf("%f",App::preferred_fps); - return true; - } - if(key=="predefined_fps") - { - value=strprintf("%s",App::predefined_fps.c_str()); - return true; - } - - return synfigapp::Settings::get_value(key,value); - } - - virtual bool set_value(const synfig::String& key,const synfig::String& value) - { - if(key=="gamma") - { - float r,g,b,blk; - - strscanf(value,"%f %f %f %f", - &r, - &g, - &b, - &blk - ); - - App::gamma.set_all(r,g,b,blk); - - return true; - } - if(key=="time_format") - { - int i(atoi(value.c_str())); - App::set_time_format(static_cast(i)); - return true; - } - if(key=="auto_recover_backup_interval") - { - int i(atoi(value.c_str())); - App::auto_recover->set_timeout(i); - return true; - } - if(key=="file_history.size") - { - int i(atoi(value.c_str())); - App::set_max_recent_files(i); - return true; - } - if(key=="use_colorspace_gamma") - { - int i(atoi(value.c_str())); - App::use_colorspace_gamma=i; - return true; - } - if(key=="distance_system") - { - App::distance_system=Distance::ident_system(value);; - return true; - } -#ifdef SINGLE_THREADED - if(key=="single_threaded") - { - int i(atoi(value.c_str())); - App::single_threaded=i; - return true; - } -#endif - if(key=="restrict_radius_ducks") - { - int i(atoi(value.c_str())); - App::restrict_radius_ducks=i; - return true; - } - if(key=="resize_imported_images") - { - int i(atoi(value.c_str())); - App::resize_imported_images=i; - return true; - } - if(key=="browser_command") - { - App::browser_command=value; - return true; - } - if(key=="custom_filename_prefix") - { - App::custom_filename_prefix=value; - return true; - } - if(key=="preferred_x_size") - { - int i(atoi(value.c_str())); - App::preferred_x_size=i; - return true; - } - if(key=="preferred_y_size") - { - int i(atoi(value.c_str())); - App::preferred_y_size=i; - return true; - } - if(key=="predefined_size") - { - App::predefined_size=value; - return true; - } - if(key=="preferred_fps") - { - float i(atof(value.c_str())); - App::preferred_fps=i; - return true; - } - if(key=="predefined_fps") - { - App::predefined_fps=value; - return true; - } - - return synfigapp::Settings::set_value(key,value); - } - - virtual KeyList get_key_list()const - { - KeyList ret(synfigapp::Settings::get_key_list()); - ret.push_back("gamma"); - ret.push_back("time_format"); - ret.push_back("distance_system"); - ret.push_back("file_history.size"); - ret.push_back("use_colorspace_gamma"); -#ifdef SINGLE_THREADED - ret.push_back("single_threaded"); -#endif - ret.push_back("auto_recover_backup_interval"); - ret.push_back("restrict_radius_ducks"); - ret.push_back("resize_imported_images"); - ret.push_back("browser_command"); - ret.push_back("custom_filename_prefix"); - ret.push_back("preferred_x_size"); - ret.push_back("preferred_y_size"); - ret.push_back("predefined_size"); - ret.push_back("preferred_fps"); - ret.push_back("predefined_fps"); - return ret; - } -}; - -static ::Preferences _preferences; - -void -init_ui_manager() -{ - Glib::RefPtr menus_action_group = Gtk::ActionGroup::create("menus"); - - Glib::RefPtr toolbox_action_group = Gtk::ActionGroup::create("toolbox"); - - Glib::RefPtr actions_action_group = Gtk::ActionGroup::create("actions"); - - menus_action_group->add( Gtk::Action::create("menu-file", _("_File")) ); - menus_action_group->add( Gtk::Action::create("menu-edit", _("_Edit")) ); - menus_action_group->add( Gtk::Action::create("menu-view", _("_View")) ); - menus_action_group->add( Gtk::Action::create("menu-canvas", _("_Canvas")) ); - menus_action_group->add( Gtk::Action::create("menu-layer", _("_Layer")) ); - menus_action_group->add( Gtk::Action::create("menu-duck-mask", _("Show/Hide Ducks")) ); - menus_action_group->add( Gtk::Action::create("menu-preview-quality", _("Preview Quality")) ); - menus_action_group->add( Gtk::Action::create("menu-lowres-pixel", _("Low-Res Pixel Size")) ); - menus_action_group->add( Gtk::Action::create("menu-layer-new", _("New Layer")) ); - menus_action_group->add( Gtk::Action::create("menu-keyframe", _("Keyframe")) ); - menus_action_group->add( Gtk::Action::create("menu-group", _("Group")) ); - menus_action_group->add( Gtk::Action::create("menu-state", _("Tool")) ); - menus_action_group->add( Gtk::Action::create("menu-toolbox", _("Toolbox")) ); - - // Add the synfigapp actions... - synfigapp::Action::Book::iterator iter; - for(iter=synfigapp::Action::book().begin();iter!=synfigapp::Action::book().end();++iter) - { - actions_action_group->add(Gtk::Action::create( - "action-"+iter->second.name, - get_action_stock_id(iter->second), - iter->second.local_name,iter->second.local_name - )); - } - -#define DEFINE_ACTION(x,stock) { Glib::RefPtr action( Gtk::Action::create(x, stock) ); actions_action_group->add(action); } -#define DEFINE_ACTION2(x,stock,label) { Glib::RefPtr action( Gtk::Action::create(x, stock,label,label) ); actions_action_group->add(action); } -#define DEFINE_ACTION_SIG(group,x,stock,sig) { Glib::RefPtr action( Gtk::Action::create(x, stock) ); group->add(action,sig); } - - DEFINE_ACTION2("keyframe-properties", Gtk::StockID("gtk-properties"), _("Keyframe Properties")); - DEFINE_ACTION("about", Gtk::StockID("synfig-about")); - DEFINE_ACTION("new", Gtk::Stock::NEW); - DEFINE_ACTION("open", Gtk::Stock::OPEN); - DEFINE_ACTION("save", Gtk::Stock::SAVE); - DEFINE_ACTION("save-as", Gtk::Stock::SAVE_AS); - DEFINE_ACTION("revert", Gtk::Stock::REVERT_TO_SAVED); - DEFINE_ACTION("cvs-add", Gtk::StockID("synfig-cvs_add")); - DEFINE_ACTION("cvs-update", Gtk::StockID("synfig-cvs_update")); - DEFINE_ACTION("cvs-commit", Gtk::StockID("synfig-cvs_commit")); - DEFINE_ACTION("cvs-revert", Gtk::StockID("synfig-cvs_revert")); - DEFINE_ACTION("import", _("Import")); - DEFINE_ACTION("render", _("Render")); - DEFINE_ACTION("preview", _("Preview")); - DEFINE_ACTION("dialog-flipbook", _("Preview Dialog")); - DEFINE_ACTION("sound", _("Sound File")); - DEFINE_ACTION("options", _("Options")); - DEFINE_ACTION("close", _("Close View")); - DEFINE_ACTION("close-document", _("Close Document")); - DEFINE_ACTION("quit", Gtk::Stock::QUIT); - - - DEFINE_ACTION("undo", Gtk::StockID("gtk-undo")); - DEFINE_ACTION("redo", Gtk::StockID("gtk-redo")); - DEFINE_ACTION("cut", Gtk::StockID("gtk-cut")); - DEFINE_ACTION("copy", Gtk::StockID("gtk-copy")); - DEFINE_ACTION("paste", Gtk::StockID("gtk-paste")); - DEFINE_ACTION("select-all-ducks", _("Select All Ducks")); - DEFINE_ACTION("unselect-all-ducks", _("Unselect All Ducks")); - DEFINE_ACTION("select-all-layers", _("Select All Layers")); - DEFINE_ACTION("unselect-all-layers", _("Unselect All Layers")); - DEFINE_ACTION("properties", _("Properties")); - - DEFINE_ACTION("mask-position-ducks", _("Show Position Ducks")); - DEFINE_ACTION("mask-vertex-ducks", _("Show Vertex Ducks")); - DEFINE_ACTION("mask-tangent-ducks", _("Show Tangent Ducks")); - DEFINE_ACTION("mask-radius-ducks", _("Show Radius Ducks")); - DEFINE_ACTION("mask-width-ducks", _("Show Width Ducks")); - DEFINE_ACTION("mask-angle-ducks", _("Show Angle Ducks")); - DEFINE_ACTION("quality-00", _("Use Parametric Renderer")); - DEFINE_ACTION("quality-01", _("Use Quality Level 1")); - DEFINE_ACTION("quality-02", _("Use Quality Level 2")); - DEFINE_ACTION("quality-03", _("Use Quality Level 3")); - DEFINE_ACTION("quality-04", _("Use Quality Level 4")); - DEFINE_ACTION("quality-05", _("Use Quality Level 5")); - DEFINE_ACTION("quality-06", _("Use Quality Level 6")); - DEFINE_ACTION("quality-07", _("Use Quality Level 7")); - DEFINE_ACTION("quality-08", _("Use Quality Level 8")); - DEFINE_ACTION("quality-09", _("Use Quality Level 9")); - DEFINE_ACTION("quality-10", _("Use Quality Level 10")); - for(list::iterator iter = CanvasView::get_pixel_sizes().begin(); iter != CanvasView::get_pixel_sizes().end(); iter++) - DEFINE_ACTION(strprintf("lowres-pixel-%d", *iter), strprintf(_("Set Low-Res pixel size to %d"), *iter)); - DEFINE_ACTION("play", _("Play")); - // DEFINE_ACTION("pause", _("Pause")); - DEFINE_ACTION("stop", _("Stop")); - DEFINE_ACTION("toggle-grid-show", _("Toggle Grid Show")); - DEFINE_ACTION("toggle-grid-snap", _("Toggle Grid Snap")); - DEFINE_ACTION("toggle-guide-show", _("Toggle Guide Show")); - DEFINE_ACTION("toggle-low-res", _("Toggle Low-Res")); - DEFINE_ACTION("decrease-low-res-pixel-size", _("Decrease Low-Res Pixel Size")); - DEFINE_ACTION("increase-low-res-pixel-size", _("Increase Low-Res Pixel Size")); - DEFINE_ACTION("toggle-onion-skin", _("Toggle Onion Skin")); - DEFINE_ACTION("canvas-zoom-in", Gtk::StockID("gtk-zoom-in")); - DEFINE_ACTION("canvas-zoom-out", Gtk::StockID("gtk-zoom-out")); - DEFINE_ACTION("canvas-zoom-fit", Gtk::StockID("gtk-zoom-fit")); - DEFINE_ACTION("canvas-zoom-100", Gtk::StockID("gtk-zoom-100")); - DEFINE_ACTION("time-zoom-in", Gtk::StockID("gtk-zoom-in")); - DEFINE_ACTION("time-zoom-out", Gtk::StockID("gtk-zoom-out")); - DEFINE_ACTION("jump-next-keyframe", _("Jump to Next Keyframe")); - DEFINE_ACTION("jump-prev-keyframe", _("Jump to Prev Keyframe")); - DEFINE_ACTION("seek-next-frame", _("Next Frame")); - DEFINE_ACTION("seek-prev-frame", _("Prev Frame")); - DEFINE_ACTION("seek-next-second", _("Seek Forward")); - DEFINE_ACTION("seek-prev-second", _("Seek Backward")); - DEFINE_ACTION("seek-begin", _("Seek to Begin")); - DEFINE_ACTION("seek-end", _("Seek to End")); - - DEFINE_ACTION("action-group_add", _("Add group")); - - DEFINE_ACTION("canvas-new", _("New Canvas")); - - DEFINE_ACTION("amount-inc", _("Increase Amount")); - DEFINE_ACTION("amount-dec", _("Decrease Amount")); - -#undef DEFINE_ACTION -#undef DEFINE_ACTION_2 -#undef DEFINE_ACTION_SIG - - Glib::ustring ui_info = -"" -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -; - - for(list::iterator iter = CanvasView::get_pixel_sizes().begin(); iter != CanvasView::get_pixel_sizes().end(); iter++) - ui_info += strprintf(" ", *iter); - - ui_info += -" " -" " -" " -//" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -" " -//" " -//" " -//" " -//" " -" " -" " -" " -" " -" " -" " -" " -" " - -"" -; -/* "" - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - " " - ""; -*/ - try - { - actions_action_group->set_sensitive(false); - App::ui_manager()->set_add_tearoffs(true); - App::ui_manager()->insert_action_group(menus_action_group,1); - App::ui_manager()->insert_action_group(actions_action_group,1); - App::ui_manager()->add_ui_from_string(ui_info); - - //App::ui_manager()->get_accel_group()->unlock(); - } - catch(const Glib::Error& ex) - { - synfig::error("building menus and toolbars failed: " + ex.what()); - } - - // Add default keyboard accelerators -#define ACCEL(accel,path) \ - { \ - Gtk::AccelKey accel_key(accel,path); \ - Gtk::AccelMap::add_entry(accel_key.get_path(), accel_key.get_key(), accel_key.get_mod()); \ - } - -#define ACCEL2(accel) \ - { \ - Gtk::AccelKey accel_key(accel); \ - Gtk::AccelMap::add_entry(accel_key.get_path(), accel_key.get_key(), accel_key.get_mod()); \ - } - - // the toolbox - ACCEL("a", "/action_group_state_manager/state-normal" ); - ACCEL("v", "/action_group_state_manager/state-smooth_move" ); - ACCEL("s", "/action_group_state_manager/state-scale" ); - ACCEL("t", "/action_group_state_manager/state-rotate" ); - ACCEL("m", "/action_group_state_manager/state-mirror" ); - ACCEL("c", "/action_group_state_manager/state-circle" ); - ACCEL("r", "/action_group_state_manager/state-rectangle" ); - ACCEL("q", "/action_group_state_manager/state-star" ); - ACCEL("g", "/action_group_state_manager/state-gradient" ); - ACCEL("p", "/action_group_state_manager/state-polygon" ); - ACCEL("b", "/action_group_state_manager/state-bline" ); - ACCEL("x", "/action_group_state_manager/state-text" ); - ACCEL("f", "/action_group_state_manager/state-fill" ); - ACCEL("e", "/action_group_state_manager/state-eyedrop" ); - ACCEL("z", "/action_group_state_manager/state-zoom" ); - ACCEL("d", "/action_group_state_manager/state-draw" ); - ACCEL("k", "/action_group_state_manager/state-sketch" ); - ACCEL("w", "/action_group_state_manager/state-width" ); - - // everything else - ACCEL("a", "/canvasview/select-all-ducks" ); - ACCEL("d", "/canvasview/unselect-all-ducks" ); - ACCEL("a", "/canvasview/select-all-layers" ); - ACCEL("d", "/canvasview/unselect-all-layers" ); - ACCEL("F9", "/canvasview/render" ); - ACCEL("F11", "/canvasview/preview" ); - ACCEL("F8", "/canvasview/properties" ); - ACCEL("F12", "/canvasview/options" ); - ACCEL("i", "/canvasview/import" ); - ACCEL2(Gtk::AccelKey(GDK_Escape,static_cast(0), "/canvasview/stop" )); - ACCEL("g", "/canvasview/toggle-grid-show" ); - ACCEL("l", "/canvasview/toggle-grid-snap" ); - ACCEL2(Gtk::AccelKey('`',Gdk::CONTROL_MASK, "/canvasview/toggle-low-res" )); - ACCEL("1", "/canvasview/mask-position-ducks" ); - ACCEL("2", "/canvasview/mask-vertex-ducks" ); - ACCEL("3", "/canvasview/mask-tangent-ducks" ); - ACCEL("4", "/canvasview/mask-radius-ducks" ); - ACCEL("5", "/canvasview/mask-width-ducks" ); - ACCEL("6", "/canvasview/mask-angle-ducks" ); - ACCEL2(Gtk::AccelKey(GDK_Page_Up,Gdk::SHIFT_MASK, "/action_group_layer_action_manager/action-LayerRaise" )); - ACCEL2(Gtk::AccelKey(GDK_Page_Down,Gdk::SHIFT_MASK, "/action_group_layer_action_manager/action-LayerLower" )); - ACCEL("1", "/canvasview/quality-01" ); - ACCEL("2", "/canvasview/quality-02" ); - ACCEL("3", "/canvasview/quality-03" ); - ACCEL("4", "/canvasview/quality-04" ); - ACCEL("5", "/canvasview/quality-05" ); - ACCEL("6", "/canvasview/quality-06" ); - ACCEL("7", "/canvasview/quality-07" ); - ACCEL("8", "/canvasview/quality-08" ); - ACCEL("9", "/canvasview/quality-09" ); - ACCEL("0", "/canvasview/quality-10" ); - ACCEL("z", "/action_group_dock_history/undo" ); - ACCEL("r", "/action_group_dock_history/redo" ); - ACCEL2(Gtk::AccelKey(GDK_Delete,Gdk::CONTROL_MASK, "/action_group_layer_action_manager/action-LayerRemove" )); - ACCEL2(Gtk::AccelKey('(',Gdk::CONTROL_MASK, "/canvasview/decrease-low-res-pixel-size" )); - ACCEL2(Gtk::AccelKey(')',Gdk::CONTROL_MASK, "/canvasview/increase-low-res-pixel-size" )); - ACCEL2(Gtk::AccelKey('(',Gdk::MOD1_MASK|Gdk::CONTROL_MASK, "/action_group_layer_action_manager/amount-dec" )); - ACCEL2(Gtk::AccelKey(')',Gdk::MOD1_MASK|Gdk::CONTROL_MASK, "/action_group_layer_action_manager/amount-inc" )); - ACCEL2(Gtk::AccelKey(']',Gdk::CONTROL_MASK, "/canvasview/jump-next-keyframe" )); - ACCEL2(Gtk::AccelKey('[',Gdk::CONTROL_MASK, "/canvasview/jump-prev-keyframe" )); - ACCEL2(Gtk::AccelKey('=',Gdk::CONTROL_MASK, "/canvasview/canvas-zoom-in" )); - ACCEL2(Gtk::AccelKey('-',Gdk::CONTROL_MASK, "/canvasview/canvas-zoom-out" )); - ACCEL2(Gtk::AccelKey('+',Gdk::CONTROL_MASK, "/canvasview/time-zoom-in" )); - ACCEL2(Gtk::AccelKey('_',Gdk::CONTROL_MASK, "/canvasview/time-zoom-out" )); - ACCEL2(Gtk::AccelKey('.',Gdk::CONTROL_MASK, "/canvasview/seek-next-frame" )); - ACCEL2(Gtk::AccelKey(',',Gdk::CONTROL_MASK, "/canvasview/seek-prev-frame" )); - ACCEL2(Gtk::AccelKey('>',Gdk::CONTROL_MASK, "/canvasview/seek-next-second" )); - ACCEL2(Gtk::AccelKey('<',Gdk::CONTROL_MASK, "/canvasview/seek-prev-second" )); - ACCEL("o", "/canvasview/toggle-onion-skin" ); - ACCEL("z", "/canvasview/canvas-zoom-fit" ); - ACCEL("p", "/canvasview/play" ); - ACCEL("Home", "/canvasview/seek-begin" ); - ACCEL("End", "/canvasview/seek-end" ); - -#undef ACCEL -#undef ACCEL2 -} - -#ifdef _WIN32 -#define mkdir(x,y) mkdir(x) -#endif - -/* === M E T H O D S ======================================================= */ - -App::App(int *argc, char ***argv): - Gtk::Main(argc,argv), - IconController(etl::dirname((*argv)[0])) -{ - app_base_path_=etl::dirname(etl::dirname((*argv)[0])); - - - ui_interface_=new GlobalUIInterface(); - - gdk_rgb_init(); - - // don't call thread_init() if threads are already initialized - // on some machines bonobo_init() initialized threads before we get here - if (!g_thread_supported()) - Glib::thread_init(); - - distance_system=Distance::SYSTEM_UNITS; - - if(mkdir(get_user_app_directory().c_str(),ACCESSPERMS)<0) - { - if(errno!=EEXIST) - synfig::error("UNABLE TO CREATE \"%s\"",get_user_app_directory().c_str()); - } - else - { - synfig::info("Created directory \"%s\"",get_user_app_directory().c_str()); - } - - - ipc=new IPC(); - - if(!SYNFIG_CHECK_VERSION()) - { - cerr<<"FATAL: Synfig Version Mismatch"<(new synfigapp::Main(etl::dirname((*argv)[0]),&synfig_init_cb)); } - catch(std::runtime_error x) - { - get_ui_interface()->error(strprintf("%s\n\n%s", _("Failed to initialize synfig!"), x.what())); - throw; - } - catch(...) - { - get_ui_interface()->error(_("Failed to initialize synfig!")); - throw; - } - - // add the preferences to the settings - synfigapp::Main::settings().add_domain(&_preferences,"pref"); - - try - { - studio_init_cb.task(_("Init UI Manager...")); - App::ui_manager_=studio::UIManager::create(); - init_ui_manager(); - - studio_init_cb.task(_("Init Dock Manager...")); - dock_manager=new studio::DockManager(); - - studio_init_cb.task(_("Init State Manager...")); - state_manager=new StateManager(); - - studio_init_cb.task(_("Init Toolbox...")); - toolbox=new studio::Toolbox(); - - studio_init_cb.task(_("Init About Dialog...")); - about=new studio::About(); - - studio_init_cb.task(_("Init Tool Options...")); - dialog_tool_options=new studio::Dialog_ToolOptions(); - dock_manager->register_dockable(*dialog_tool_options); - - studio_init_cb.task(_("Init History...")); - dock_history=new studio::Dock_History(); - dock_manager->register_dockable(*dock_history); - - studio_init_cb.task(_("Init Canvases...")); - dock_canvases=new studio::Dock_Canvases(); - dock_manager->register_dockable(*dock_canvases); - - studio_init_cb.task(_("Init Keyframes...")); - dock_keyframes=new studio::Dock_Keyframes(); - dock_manager->register_dockable(*dock_keyframes); - - studio_init_cb.task(_("Init Layers...")); - dock_layers=new studio::Dock_Layers(); - dock_manager->register_dockable(*dock_layers); - - studio_init_cb.task(_("Init Params...")); - dock_params=new studio::Dock_Params(); - dock_manager->register_dockable(*dock_params); - - studio_init_cb.task(_("Init MetaData...")); - dock_meta_data=new studio::Dock_MetaData(); - dock_manager->register_dockable(*dock_meta_data); - - studio_init_cb.task(_("Init Children...")); - dock_children=new studio::Dock_Children(); - dock_manager->register_dockable(*dock_children); - - studio_init_cb.task(_("Init Info...")); - dock_info = new studio::Dock_Info(); - dock_manager->register_dockable(*dock_info); - - studio_init_cb.task(_("Init Navigator...")); - dock_navigator = new studio::Dock_Navigator(); - dock_manager->register_dockable(*dock_navigator); - - studio_init_cb.task(_("Init Timetrack...")); - dock_timetrack = new studio::Dock_Timetrack(); - dock_manager->register_dockable(*dock_timetrack); - - studio_init_cb.task(_("Init Curve Editor...")); - dock_curves = new studio::Dock_Curves(); - dock_manager->register_dockable(*dock_curves); - - studio_init_cb.task(_("Init Layer Groups...")); - dock_layer_groups = new studio::Dock_LayerGroups(); - dock_manager->register_dockable(*dock_layer_groups); - - - studio_init_cb.task(_("Init Color Dialog...")); - dialog_color=new studio::Dialog_Color(); - - studio_init_cb.task(_("Init Gradient Dialog...")); - dialog_gradient=new studio::Dialog_Gradient(); - - studio_init_cb.task(_("Init DeviceTracker...")); - device_tracker=new studio::DeviceTracker(); - - studio_init_cb.task(_("Init Tools...")); - - /* editing tools */ - state_manager->add_state(&state_normal); - state_manager->add_state(&state_smooth_move); - state_manager->add_state(&state_scale); - state_manager->add_state(&state_rotate); - studio_init_cb.task(_("Init ModMirror...")); module_list_.push_back(new ModMirror()); module_list_.back()->start(); - if(!getenv("SYNFIG_DISABLE_WIDTH" )) state_manager->add_state(&state_width); // Enabled since 0.61.09 - - /* new objects */ - state_manager->add_state(&state_circle); - state_manager->add_state(&state_rectangle); - state_manager->add_state(&state_star); - state_manager->add_state(&state_gradient); - if(!getenv("SYNFIG_DISABLE_POLYGON")) state_manager->add_state(&state_polygon); // Enabled - for working without ducks - state_manager->add_state(&state_text); - state_manager->add_state(&state_bline); - if(!getenv("SYNFIG_DISABLE_DRAW" )) state_manager->add_state(&state_draw); // Enabled for now. Let's see whether they're good enough yet. - - /* other */ - state_manager->add_state(&state_fill); - state_manager->add_state(&state_eyedrop); - state_manager->add_state(&state_zoom); - if(!getenv("SYNFIG_DISABLE_SKETCH" )) state_manager->add_state(&state_sketch); - - studio_init_cb.task(_("Init ModPalette...")); - module_list_.push_back(new ModPalette()); module_list_.back()->start(); - - studio_init_cb.task(_("Init Setup Dialog...")); - dialog_setup=new studio::Dialog_Setup(); - - studio_init_cb.task(_("Init Input Dialog...")); - dialog_input=new Gtk::InputDialog(); - dialog_input->get_close_button()->signal_clicked().connect( sigc::mem_fun( *dialog_input, &Gtk::InputDialog::hide ) ); - dialog_input->get_save_button()->signal_clicked().connect( sigc::mem_fun( *device_tracker, &DeviceTracker::save_preferences) ); - - studio_init_cb.task(_("Init auto recovery...")); - auto_recover=new AutoRecover(); - - studio_init_cb.amount_complete(9250,10000); - studio_init_cb.task(_("Loading Settings...")); - load_settings(); - device_tracker->load_preferences(); - - studio_init_cb.task(_("Checking auto-recover...")); - - studio_init_cb.amount_complete(9900,10000); - - bool opened_any = false; - if(auto_recover->recovery_needed()) - { - splash_screen.hide(); - if (get_ui_interface()->confirmation("Crash Recovery", - _("Auto recovery file found"), - _("Synfig Studio seems to have crashed\n" - "before you could save all your files.\n" - "Recover unsaved changes?"), - _("Recover"), _("Ignore")) - == synfigapp::UIInterface::RESPONSE_OK) - { - int number_recovered; - if(!auto_recover->recover(number_recovered)) - if (number_recovered) - get_ui_interface()->error(_("Unable to fully recover from previous crash")); - else - get_ui_interface()->error(_("Unable to recover from previous crash")); - else - get_ui_interface()->error( - _("Synfig Studio has attempted to recover\n" - "from a previous crash. The files that it has\n" - "recovered are NOT YET SAVED. It would be a good\n" - "idea to review them and save them now.")); - - if (number_recovered) - opened_any = true; - } - splash_screen.show(); - } - - // Look for any files given on the command line, - // and load them if found. - for(;*argc>=1;(*argc)--) - if((*argv)[*argc] && (*argv)[*argc][0]!='-') - { - studio_init_cb.task(_("Loading files...")); - splash_screen.hide(); - open((*argv)[*argc]); - opened_any = true; - splash_screen.show(); - } - - // if no file was specified to be opened, create a new document to help new users get started more easily - if (!opened_any && !getenv("SYNFIG_DISABLE_AUTOMATIC_DOCUMENT_CREATION")) - new_instance(); - - studio_init_cb.task(_("Done.")); - studio_init_cb.amount_complete(10000,10000); - - toolbox->present(); - } - catch(String x) - { - get_ui_interface()->error(_("Unknown exception caught when constructing App.\nThis software may be unstable.") + String("\n\n") + x); - } - catch(...) - { - get_ui_interface()->error(_("Unknown exception caught when constructing App.\nThis software may be unstable.")); - } -} - -StateManager* App::get_state_manager() { return state_manager; } - -App::~App() -{ - shutdown_in_progress=true; - - save_settings(); - - synfigapp::Main::settings().remove_domain("pref"); - - selected_instance=0; - - // Unload all of the modules - for(;!module_list_.empty();module_list_.pop_back()) - ; - - delete state_manager; - - delete ipc; - - delete auto_recover; - - delete about; - - toolbox->hide(); - - delete toolbox; - - delete dialog_setup; - - delete dialog_gradient; - - delete dialog_color; - - delete dialog_input; - - delete dock_manager; - - instance_list.clear(); -} - -String -App::get_user_app_directory() -{ -//! \todo do we need locale_from_utf8() on non-Windows boxes too? (bug #1837445) -#ifdef WIN32 - return Glib::locale_from_utf8(Glib::build_filename(Glib::get_home_dir(),SYNFIG_USER_APP_DIR)); -#else - return Glib::build_filename(Glib::get_home_dir(),SYNFIG_USER_APP_DIR); -#endif -} - -synfig::String -App::get_config_file(const synfig::String& file) -{ - return Glib::build_filename(get_user_app_directory(),file); -} - -#define SCALE_FACTOR (1280) -//! set the \a instance's canvas(es) position and size to be those specified in the first entry of recent_files_window_size -void -App::set_recent_file_window_size(etl::handle instance) -{ - int screen_w(Gdk::screen_width()); - int screen_h(Gdk::screen_height()); - - const std::string &canvas_window_size = *recent_files_window_size.begin(); - - if(canvas_window_size.empty()) - return; - - synfig::String::size_type current=0; - bool seen_root(false), shown_non_root(false); - - while(current != synfig::String::npos) - { - // find end of first field (canvas) or return - synfig::String::size_type separator = canvas_window_size.find_first_of(' ', current); - if(separator == synfig::String::npos) break; - - // find the canvas - synfig::Canvas::Handle canvas; - try { - String warnings; - canvas = instance->get_canvas()->find_canvas(String(canvas_window_size, current, separator-current), warnings); - } - catch(Exception::IDNotFound) { - // can't find the canvas; skip to the next canvas or return - separator = canvas_window_size.find_first_of('\t', current); - if(separator == synfig::String::npos) return; - current = separator+1; - continue; - } - - if (canvas->is_root()) - seen_root = true; - else - shown_non_root = true; - - // check that we have the tab character the ends this canvas' data or return - current = separator+1; - separator = canvas_window_size.find_first_of('\t', current); - if(separator == synfig::String::npos) return; - - int x,y,w,h; - if(!strscanf(String(canvas_window_size, current, separator-current),"%d %d %d %d",&x, &y, &w, &h)) - { - current = separator+1; - continue; - } - - if (x > SCALE_FACTOR) x = SCALE_FACTOR - 150; if (x < 0) x = 0; - if (y > SCALE_FACTOR) y = SCALE_FACTOR - 150; if (y < 0) y = 0; - x=x*screen_w/SCALE_FACTOR; - y=y*screen_h/SCALE_FACTOR; - if(getenv("SYNFIG_WINDOW_POSITION_X_OFFSET")) - x += atoi(getenv("SYNFIG_WINDOW_POSITION_X_OFFSET")); - if(getenv("SYNFIG_WINDOW_POSITION_Y_OFFSET")) - y += atoi(getenv("SYNFIG_WINDOW_POSITION_Y_OFFSET")); - - if (w > SCALE_FACTOR) w = 150; if (w < 0) w = 0; - if (h > SCALE_FACTOR) h = 150; if (h < 0) h = 0; - - CanvasView::Handle canvasview = instance->find_canvas_view(canvas); - canvasview->move(x,y); - canvasview->resize(w*screen_w/SCALE_FACTOR,h*screen_h/SCALE_FACTOR); - canvasview->present(); - - current = separator+1; - } - - if (shown_non_root && !seen_root) - instance->find_canvas_view(instance->get_canvas())->hide(); -} - -void -App::add_recent_file(const etl::handle instance) -{ - int screen_w(Gdk::screen_width()); - int screen_h(Gdk::screen_height()); - - std::string canvas_window_size; - - const Instance::CanvasViewList& cview_list = instance->canvas_view_list(); - Instance::CanvasViewList::const_iterator iter; - - for(iter=cview_list.begin();iter!=cview_list.end();iter++) - { - if( !((*iter)->is_visible()) ) - continue; - - etl::handle canvas = (*iter)->get_canvas(); - int x_pos, y_pos, x_size, y_size; - (*iter)->get_position(x_pos,y_pos); - (*iter)->get_size(x_size,y_size); - - canvas_window_size += strprintf("%s %d %d %d %d\t", - canvas->get_relative_id(canvas->get_root()).c_str(), - x_pos*SCALE_FACTOR/screen_w, y_pos*SCALE_FACTOR/screen_h, - x_size*SCALE_FACTOR/screen_w, y_size*SCALE_FACTOR/screen_h); - } - - add_recent_file(absolute_path(instance->get_file_name()), canvas_window_size); -} -#undef SCALE_FACTOR - -void -App::add_recent_file(const std::string &file_name, const std::string &window_size) -{ - std::string filename(file_name); - - assert(!filename.empty()); - - if(filename.empty()) - return; - - // Toss out any "hidden" files - if(basename(filename)[0]=='.') - return; - - // If we aren't an absolute path, turn ourselves into one - if(!is_absolute_path(filename)) - filename=absolute_path(filename); - - std::string old_window_size; - - list::iterator iter; - list::iterator iter_wsize; - // Check to see if the file is already on the list. - // If it is, then remove it from the list - for(iter=recent_files.begin(), iter_wsize=recent_files_window_size.begin();iter!=recent_files.end();iter++, iter_wsize++) - if(*iter==filename) - { - recent_files.erase(iter); - old_window_size = *iter_wsize; - recent_files_window_size.erase(iter_wsize); - break; - } - - - // Push the filename to the front of the list - recent_files.push_front(filename); - if(window_size.empty()) - recent_files_window_size.push_front(old_window_size); - else - recent_files_window_size.push_front(window_size); - - // Clean out the files at the end of the list. - while(recent_files.size()>(unsigned)get_max_recent_files()) - { - recent_files.pop_back(); - recent_files_window_size.pop_back(); - } - - signal_recent_files_changed_(); - - return; -} - -static Time::Format _App_time_format(Time::FORMAT_NORMAL); - -Time::Format -App::get_time_format() -{ - return _App_time_format; -} - -void -App::set_time_format(synfig::Time::Format x) -{ - _App_time_format=x; -} - - -void -App::save_settings() -{ - char * old_locale; - try - { - old_locale=strdup(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC, "C"); - { - std::string filename=get_config_file("accelrc"); - Gtk::AccelMap::save(filename); - } - do{ - std::string filename=get_config_file("recentfiles"); - - std::ofstream file(filename.c_str()); - - if(!file) - { - synfig::warning("Unable to save %s",filename.c_str()); - break; - } - - list::reverse_iterator iter; - - for(iter=recent_files.rbegin();iter!=recent_files.rend();iter++) - file<<*iter<::reverse_iterator iter; - - for(iter=recent_files_window_size.rbegin();iter!=recent_files_window_size.rend();iter++) - file<<*iter<task(_("Quit Request")); - if(Busy::count) - { - dialog_error_blocking(_("Cannot quit!"),_("Tasks are currently running.\nPlease cancel the current tasks and try again")); - return; - } - - std::list >::iterator iter; - for(iter=instance_list.begin();!instance_list.empty();iter=instance_list.begin()) - { - if(!(*iter)->safe_close()) - return; - -/* - if((*iter)->synfigapp::Instance::get_action_count()) - { - handle uim; - uim=(*iter)->find_canvas_view((*iter)->get_canvas())->get_ui_interface(); - assert(uim); - string str=strprintf(_("Would you like to save your changes to %s?"),(*iter)->get_file_name().c_str() ); - switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES)) - { - case synfigapp::UIInterface::RESPONSE_NO: - break; - case synfigapp::UIInterface::RESPONSE_YES: - (*iter)->save(); - break; - case synfigapp::UIInterface::RESPONSE_CANCEL: - return; - default: - assert(0); - return; - } - } - - - if((*iter)->synfigapp::Instance::is_modified()) - { - handle uim; - uim=(*iter)->find_canvas_view((*iter)->get_canvas())->get_ui_interface(); - assert(uim); - string str=strprintf(_("%s has changes not yet on the CVS repository.\nWould you like to commit these changes?"),(*iter)->get_file_name().c_str() ); - switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES)) - { - case synfigapp::UIInterface::RESPONSE_NO: - break; - case synfigapp::UIInterface::RESPONSE_YES: - (*iter)->dialog_cvs_commit(); - break; - case synfigapp::UIInterface::RESPONSE_CANCEL: - return; - default: - assert(0); - return; - } - } -*/ - - // This next line causes things to crash for some reason - //(*iter)->close(); - } - - shutdown_in_progress=true; - - instance_list.clear(); - - while(studio::App::events_pending())studio::App::iteration(false); - - Gtk::Main::quit(); - auto_recover->normal_shutdown(); - - get_ui_interface()->task(_("Quit Request sent")); -} - -void -App::show_setup() -{ - dialog_setup->refresh(); - dialog_setup->show(); -} - -gint Signal_Open_Ok(GtkWidget */*widget*/, int *val){*val=1;return 0;} -gint Signal_Open_Cancel(GtkWidget */*widget*/, int *val){*val=2;return 0;} - -//#ifdef WIN32 -//#define USE_WIN32_FILE_DIALOGS 1 -//#endif - -#ifdef USE_WIN32_FILE_DIALOGS -static OPENFILENAME ofn={}; -#endif - -#ifdef WIN32 -#include -#endif - -bool -App::dialog_open_file(const std::string &title, std::string &filename, std::string preference) -{ - // info("App::dialog_open_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str()); - -#ifdef USE_WIN32_FILE_DIALOGS - static TCHAR szFilter[] = TEXT ("All Files (*.*)\0*.*\0\0") ; - - GdkWindow *gdkWinPtr=toolbox->get_window()->gobj(); - HINSTANCE hInstance=static_cast(GetModuleHandle(NULL)); - HWND hWnd=static_cast(GDK_WINDOW_HWND(gdkWinPtr)); - - ofn.lStructSize=sizeof(OPENFILENAME); - ofn.hwndOwner = hWnd; - ofn.hInstance = hInstance; - ofn.lpstrFilter = szFilter; -// ofn.lpstrCustomFilter=NULL; -// ofn.nMaxCustFilter=0; -// ofn.nFilterIndex=0; -// ofn.lpstrFile=NULL; - ofn.nMaxFile=MAX_PATH; -// ofn.lpstrFileTitle=NULL; -// ofn.lpstrInitialDir=NULL; -// ofn.lpstrTitle=NULL; - ofn.Flags=OFN_HIDEREADONLY; -// ofn.nFileOffset=0; -// ofn.nFileExtension=0; - ofn.lpstrDefExt=TEXT("sif"); -// ofn.lCustData = 0l; - ofn.lpfnHook=NULL; -// ofn.lpTemplateName=NULL; - - CHAR szFilename[MAX_PATH]; - CHAR szTitle[500]; - strcpy(szFilename,filename.c_str()); - strcpy(szTitle,title.c_str()); - - ofn.lpstrFile=szFilename; - ofn.lpstrFileTitle=szTitle; - - if(GetOpenFileName(&ofn)) - { - filename=szFilename; - return true; - } - return false; - -#else // not USE_WIN32_FILE_DIALOGS - synfig::String prev_path; - - if(!_preferences.get_value(preference, prev_path)) - prev_path = "."; - - prev_path = absolute_path(prev_path); - - Gtk::FileChooserDialog *dialog = new Gtk::FileChooserDialog(title, Gtk::FILE_CHOOSER_ACTION_OPEN); - - dialog->set_current_folder(prev_path); - dialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - dialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_ACCEPT); - - if (filename.empty()) - dialog->set_filename(prev_path); - else if (is_absolute_path(filename)) - dialog->set_filename(filename); - else - dialog->set_filename(prev_path + ETL_DIRECTORY_SEPARATOR + filename); - - if(dialog->run() == GTK_RESPONSE_ACCEPT) { - filename = dialog->get_filename(); - // info("Saving preference %s = '%s' in App::dialog_open_file()", preference.c_str(), dirname(filename).c_str()); - _preferences.set_value(preference, dirname(filename)); - delete dialog; - return true; - } - - delete dialog; - return false; -#endif // not USE_WIN32_FILE_DIALOGS -} - -bool -App::dialog_save_file(const std::string &title, std::string &filename, std::string preference) -{ - // info("App::dialog_save_file('%s', '%s', '%s')", title.c_str(), filename.c_str(), preference.c_str()); - -#if USE_WIN32_FILE_DIALOGS - static TCHAR szFilter[] = TEXT ("All Files (*.*)\0*.*\0\0") ; - - GdkWindow *gdkWinPtr=toolbox->get_window()->gobj(); - HINSTANCE hInstance=static_cast(GetModuleHandle(NULL)); - HWND hWnd=static_cast(GDK_WINDOW_HWND(gdkWinPtr)); - - ofn.lStructSize=sizeof(OPENFILENAME); - ofn.hwndOwner = hWnd; - ofn.hInstance = hInstance; - ofn.lpstrFilter = szFilter; -// ofn.lpstrCustomFilter=NULL; -// ofn.nMaxCustFilter=0; -// ofn.nFilterIndex=0; -// ofn.lpstrFile=NULL; - ofn.nMaxFile=MAX_PATH; -// ofn.lpstrFileTitle=NULL; -// ofn.lpstrInitialDir=NULL; -// ofn.lpstrTitle=NULL; - ofn.Flags=OFN_OVERWRITEPROMPT; -// ofn.nFileOffset=0; -// ofn.nFileExtension=0; - ofn.lpstrDefExt=TEXT("sif"); -// ofn.lCustData = 0l; - ofn.lpfnHook=NULL; -// ofn.lpTemplateName=NULL; - - CHAR szFilename[MAX_PATH]; - CHAR szTitle[500]; - strcpy(szFilename,filename.c_str()); - strcpy(szTitle,title.c_str()); - - ofn.lpstrFile=szFilename; - ofn.lpstrFileTitle=szTitle; - - if(GetSaveFileName(&ofn)) - { - filename=szFilename; - _preferences.set_value(preference,dirname(filename)); - return true; - } - return false; -#else - synfig::String prev_path; - - if(!_preferences.get_value(preference, prev_path)) - prev_path="."; - - prev_path = absolute_path(prev_path); - - Gtk::FileChooserDialog *dialog = new Gtk::FileChooserDialog(title, Gtk::FILE_CHOOSER_ACTION_SAVE); - - dialog->set_current_folder(prev_path); - dialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - dialog->add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); - - Widget_Enum *file_type_enum = 0; - if (preference == ANIMATION_DIR_PREFERENCE) - { - file_type_enum = manage(new Widget_Enum()); - file_type_enum->set_param_desc(ParamDesc().set_hint("enum") - .add_enum_value(synfig::RELEASE_VERSION_0_62_00, "0.62.00", strprintf("0.62.00 (%s)", _("current"))) - .add_enum_value(synfig::RELEASE_VERSION_0_61_09, "0.61.09", "0.61.09") - .add_enum_value(synfig::RELEASE_VERSION_0_61_08, "0.61.08", "0.61.08") - .add_enum_value(synfig::RELEASE_VERSION_0_61_07, "0.61.07", "0.61.07") - .add_enum_value(synfig::RELEASE_VERSION_0_61_06, "0.61.06", strprintf("0.61.06 %s", _("and older")))); - file_type_enum->set_value(RELEASE_VERSION_END-1); // default to the most recent version - - Gtk::HBox *hbox = manage(new Gtk::HBox); - hbox->pack_start(*manage(new Gtk::Label(_("File Format Version: "))),Gtk::PACK_SHRINK,0); - hbox->pack_start(*file_type_enum,Gtk::PACK_EXPAND_WIDGET,0); - hbox->show_all(); - - dialog->set_extra_widget(*hbox); - } - - if (filename.empty()) - dialog->set_filename(prev_path); - else - { - std::string full_path; - if (is_absolute_path(filename)) - full_path = filename; - else - full_path = prev_path + ETL_DIRECTORY_SEPARATOR + filename; - - // select the file if it exists - dialog->set_filename(full_path); - - // if the file doesn't exist, put its name into the filename box - struct stat s; - if(stat(full_path.c_str(),&s) == -1 && errno == ENOENT) - dialog->set_current_name(basename(filename)); - } - - if(dialog->run() == GTK_RESPONSE_ACCEPT) { - if (preference == ANIMATION_DIR_PREFERENCE) - set_file_version(synfig::ReleaseVersion(file_type_enum->get_value())); - filename = dialog->get_filename(); - // info("Saving preference %s = '%s' in App::dialog_save_file()", preference.c_str(), dirname(filename).c_str()); - _preferences.set_value(preference, dirname(filename)); - delete dialog; - return true; - } - - delete dialog; - return false; -#endif -} - -void -App::dialog_error_blocking(const std::string &title, const std::string &message) -{ - Gtk::MessageDialog dialog(message, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true); - dialog.set_title(title); - dialog.show(); - dialog.run(); -} - -void -App::dialog_warning_blocking(const std::string &title, const std::string &message) -{ - Gtk::MessageDialog dialog(message, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_CLOSE, true); - dialog.set_title(title); - dialog.show(); - dialog.run(); -} - -bool -App::dialog_yes_no(const std::string &title, const std::string &message) -{ - Gtk::Dialog dialog( - title, // Title - true, // Modal - true // use_separator - ); - Gtk::Label label(message); - label.show(); - - dialog.get_vbox()->pack_start(label); - dialog.add_button(Gtk::StockID("gtk-yes"),1); - dialog.add_button(Gtk::StockID("gtk-no"),0); - dialog.show(); - return dialog.run(); -} - -int -App::dialog_yes_no_cancel(const std::string &title, const std::string &message) -{ - Gtk::Dialog dialog( - title, // Title - true, // Modal - true // use_separator - ); - Gtk::Label label(message); - label.show(); - - dialog.get_vbox()->pack_start(label); - dialog.add_button(Gtk::StockID("gtk-yes"),1); - dialog.add_button(Gtk::StockID("gtk-no"),0); - dialog.add_button(Gtk::StockID("gtk-cancel"),2); - dialog.show(); - return dialog.run(); -} - -void -App::dialog_not_implemented() -{ - Gtk::MessageDialog dialog(_("Feature not available"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true); - dialog.set_secondary_text(_("Sorry, this feature has not yet been implemented.")); - dialog.run(); -} - -static bool -try_open_url(const std::string &url) -{ -#ifdef WIN32 - return ShellExecute(GetDesktopWindow(), "open", url.c_str(), NULL, NULL, SW_SHOW); -#else // !WIN32 - std::vector command_line; - std::vector browsers; - browsers.reserve(23); - - // Browser wrapper scripts -#ifdef USE_OPEN_FOR_URLS - browsers.push_back("open"); // Apple MacOS X wrapper, on Linux it opens a virtual console -#endif - browsers.push_back("xdg-open"); // XDG wrapper - browsers.push_back("sensible-browser"); // Debian wrapper - browsers.push_back("gnome-open"); // GNOME wrapper - browsers.push_back("kfmclient"); // KDE wrapper - browsers.push_back("exo-open"); // XFCE wrapper - - // Alternatives system - browsers.push_back("gnome-www-browser"); // Debian GNOME alternative - browsers.push_back("x-www-browser"); // Debian GUI alternative - - // Individual browsers - browsers.push_back("firefox"); - browsers.push_back("epiphany-browser"); - browsers.push_back("epiphany"); - browsers.push_back("konqueror"); - browsers.push_back("iceweasel"); - browsers.push_back("mozilla"); - browsers.push_back("netscape"); - browsers.push_back("icecat"); - browsers.push_back("galeon"); - browsers.push_back("midori"); - browsers.push_back("safari"); - browsers.push_back("opera"); - browsers.push_back("amaya"); - browsers.push_back("netsurf"); - browsers.push_back("dillo"); - - // Try the user-specified browser first - command_line.push_back(App::browser_command); - if( command_line[0] == "kfmclient" ) command_line.push_back("openURL"); - command_line.push_back(url); - - try { Glib::spawn_async(".", command_line, Glib::SPAWN_SEARCH_PATH); return true; } - catch( Glib::SpawnError& exception ){ - - while ( !browsers.empty() ) - { - // Skip the browser if we already tried it - if( browsers[0] == App::browser_command ) - continue; - - // Construct the command line - command_line.clear(); - command_line.push_back(browsers[0]); - if( command_line[0] == "kfmclient" ) command_line.push_back("openURL"); - command_line.push_back(url); - - // Remove the browser from the list - browsers.erase(browsers.begin()); - - // Try to spawn the browser - try { Glib::spawn_async(".", command_line, Glib::SPAWN_SEARCH_PATH); } - // Failed, move on to the next one - catch(Glib::SpawnError& exception){ continue; } - return true; // No exception means we succeeded! - } - } - - return false; -#endif // !WIN32 -} - -void -App::dialog_help() -{ - if (!try_open_url("http://synfig.org/Documentation")) - { - Gtk::MessageDialog dialog(_("Documentation"), false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_CLOSE, true); - dialog.set_secondary_text(_("Documentation for Synfig Studio is available on the website:\n\nhttp://www.synfig.org/Documentation")); - dialog.set_title(_("Help")); - dialog.run(); - } -} - -void -App::open_url(const std::string &url) -{ - if(!try_open_url(url)) - { - Gtk::MessageDialog dialog(_("No browser was found. Please load this website manually:"), false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true); - dialog.set_secondary_text(url); - dialog.set_title(_("No browser found")); - dialog.run(); - } -} - -bool -App::dialog_entry(const std::string &title, const std::string &message,std::string &text) -{ - Gtk::Dialog dialog( - title, // Title - true, // Modal - true); // use_separator - - Gtk::Label label(message); - label.show(); - dialog.get_vbox()->pack_start(label); - - Gtk::Entry entry; - entry.set_text(text); - entry.show(); - entry.set_activates_default(true); - - dialog.get_vbox()->pack_start(entry); - - dialog.add_button(Gtk::StockID("gtk-ok"),Gtk::RESPONSE_OK); - dialog.add_button(Gtk::StockID("gtk-cancel"),Gtk::RESPONSE_CANCEL); - dialog.set_default_response(Gtk::RESPONSE_OK); - - entry.signal_activate().connect(sigc::bind(sigc::mem_fun(dialog,&Gtk::Dialog::response),Gtk::RESPONSE_OK)); - dialog.show(); - - if(dialog.run()!=Gtk::RESPONSE_OK) - return false; - - text=entry.get_text(); - - return true; -} - -bool -App::dialog_paragraph(const std::string &title, const std::string &message,std::string &text) -{ - Gtk::Dialog dialog( - title, // Title - true, // Modal - true); // use_separator - - Gtk::Label label(message); - label.show(); - dialog.get_vbox()->pack_start(label); - - Glib::RefPtr text_buffer(Gtk::TextBuffer::create()); - text_buffer->set_text(text); - Gtk::TextView text_view(text_buffer); - text_view.show(); - - dialog.get_vbox()->pack_start(text_view); - - dialog.add_button(Gtk::StockID("gtk-ok"),Gtk::RESPONSE_OK); - dialog.add_button(Gtk::StockID("gtk-cancel"),Gtk::RESPONSE_CANCEL); - dialog.set_default_response(Gtk::RESPONSE_OK); - - //text_entry.signal_activate().connect(sigc::bind(sigc::mem_fun(dialog,&Gtk::Dialog::response),Gtk::RESPONSE_OK)); - dialog.show(); - - if(dialog.run()!=Gtk::RESPONSE_OK) - return false; - - text=text_buffer->get_text(); - - return true; -} - -bool -App::open(std::string filename) -{ - return open_as(filename,filename); -} - -// this is called from autorecover.cpp: -// App::open_as(get_shadow_file_name(filename),filename) -// other than that, 'filename' and 'as' are the same -bool -App::open_as(std::string filename,std::string as) -{ -#ifdef WIN32 - char long_name[1024]; - if(GetLongPathName(as.c_str(),long_name,sizeof(long_name))); - // when called from autorecover.cpp, filename doesn't exist, and so long_name is empty - // don't use it if that's the case - if (long_name[0] != '\0') - as=long_name; -#endif - - try - { - OneMoment one_moment; - String errors, warnings; - - etl::handle canvas(open_canvas_as(filename,as,errors,warnings)); - if(canvas && get_instance(canvas)) - { - get_instance(canvas)->find_canvas_view(canvas)->present(); - info("%s is already open", filename.c_str()); - // throw (String)strprintf(_("\"%s\" appears to already be open!"),filename.c_str()); - } - else - { - if(!canvas) - throw (String)strprintf(_("Unable to load \"%s\":\n\n"),filename.c_str()) + errors; - - if (warnings != "") - dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str())); - - if (as.find(custom_filename_prefix.c_str()) != 0) - add_recent_file(as); - - handle instance(Instance::create(canvas)); - - if(!instance) - throw (String)strprintf(_("Unable to create instance for \"%s\""),filename.c_str()); - - set_recent_file_window_size(instance); - - one_moment.hide(); - - if(instance->is_updated() && App::dialog_yes_no(_("CVS Update"), _("There appears to be a newer version of this file available on the CVS repository.\nWould you like to update now? (It would probably be a good idea)"))) - instance->dialog_cvs_update(); - } - } - catch(String x) - { - dialog_error_blocking(_("Error"), x); - return false; - } - catch(runtime_error x) - { - dialog_error_blocking(_("Error"), x.what()); - return false; - } - catch(...) - { - dialog_error_blocking(_("Error"), _("Uncaught error on file open (BUG)")); - return false; - } - - return true; -} - - -void -App::new_instance() -{ - handle canvas=synfig::Canvas::create(); - - String file_name(strprintf("%s%d", App::custom_filename_prefix.c_str(), Instance::get_count()+1)); - canvas->set_name(file_name); - file_name += ".sifz"; - - canvas->rend_desc().set_frame_rate(preferred_fps); - canvas->rend_desc().set_time_start(0.0); - canvas->rend_desc().set_time_end(5.0); - canvas->rend_desc().set_x_res(DPI2DPM(72.0f)); - canvas->rend_desc().set_y_res(DPI2DPM(72.0f)); - // The top left and botton right positions are expressed in units - // Original convention is that 1 unit = 60 pixels - canvas->rend_desc().set_tl(Vector(-(preferred_x_size/60.0)/2.0,(preferred_y_size/60.0)/2.0)); - canvas->rend_desc().set_br(Vector((preferred_x_size/60.0)/2.0,-(preferred_y_size/60.0)/2.0)); - canvas->rend_desc().set_w(preferred_x_size); - canvas->rend_desc().set_h(preferred_y_size); - canvas->rend_desc().set_antialias(1); - canvas->rend_desc().set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN); - canvas->set_file_name(file_name); - - handle instance = Instance::create(canvas); - - if (getenv("SYNFIG_ENABLE_NEW_CANVAS_EDIT_PROPERTIES")) - instance->find_canvas_view(canvas)->canvas_properties.present(); -} - -void -App::dialog_open(string filename) -{ - if (filename.empty()) - filename="*.sif"; - - while(dialog_open_file("Open", filename, ANIMATION_DIR_PREFERENCE)) - { - // If the filename still has wildcards, then we should - // continue looking for the file we want - if(find(filename.begin(),filename.end(),'*')!=filename.end()) - continue; - - if(open(filename)) - break; - - get_ui_interface()->error(_("Unable to open file")); - } -} - -void -App::set_selected_instance(etl::loose_handle instance) -{ -/* if(get_selected_instance()==instance) - { - selected_instance=instance; - signal_instance_selected()(instance); - return; - } - else - { -*/ - selected_instance=instance; - if(get_selected_canvas_view() && get_selected_canvas_view()->get_instance()!=instance) - { - if(instance) - { - instance->focus(instance->get_canvas()); - } - else - set_selected_canvas_view(0); - } - signal_instance_selected()(instance); -} - -void -App::set_selected_canvas_view(etl::loose_handle canvas_view) -{ - selected_canvas_view=canvas_view; - signal_canvas_view_focus()(selected_canvas_view); - if(canvas_view) - { - selected_instance=canvas_view->get_instance(); - signal_instance_selected()(canvas_view->get_instance()); - } -/* - if(get_selected_canvas_view()==canvas_view) - { - signal_canvas_view_focus()(selected_canvas_view); - signal_instance_selected()(canvas_view->get_instance()); - return; - } - selected_canvas_view=canvas_view; - if(canvas_view && canvas_view->get_instance() != get_selected_instance()) - set_selected_instance(canvas_view->get_instance()); - signal_canvas_view_focus()(selected_canvas_view); -*/ -} - -etl::loose_handle -App::get_instance(etl::handle canvas) -{ - if(!canvas) return 0; - canvas=canvas->get_root(); - - std::list >::iterator iter; - for(iter=instance_list.begin();iter!=instance_list.end();++iter) - { - if((*iter)->get_canvas()==canvas) - return *iter; - } - return 0; -} - -void -App::dialog_about() -{ - if(about) - about->show(); -} - -void -studio::App::undo() -{ - if(selected_instance) - selected_instance->undo(); -} - -void -studio::App::redo() -{ - if(selected_instance) - selected_instance->redo(); -} - -synfig::String -studio::App::get_base_path() -{ - return app_base_path_; -} diff --git a/synfig-studio/src/gtkmm/app.h b/synfig-studio/src/gtkmm/app.h deleted file mode 100644 index f9960d3..0000000 --- a/synfig-studio/src/gtkmm/app.h +++ /dev/null @@ -1,363 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file app.h -** \brief writeme -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007, 2008 Chris Moore -** Copyright (c) 2008 Carlos López -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_STUDIO_APP_H -#define __SYNFIG_STUDIO_APP_H - -/* === H E A D E R S ======================================================= */ - -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include "iconcontroller.h" - -/* === M A C R O S ========================================================= */ - -#define MISC_DIR_PREFERENCE "misc_dir" -#define ANIMATION_DIR_PREFERENCE "animation_dir" -#define IMAGE_DIR_PREFERENCE "image_dir" -#define SKETCH_DIR_PREFERENCE "sketch_dir" -#define RENDER_DIR_PREFERENCE "render_dir" - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace Gtk -{ - class InputDialog; - class UIManager; - class ActionGroup; -}; - -namespace synfigapp -{ - class UIInterface; - class Main; -}; - -class Preferences; - -namespace studio { - -typedef Gtk::UIManager UIManager; - -class About; -class Toolbox; -class Instance; -class CanvasView; -class Dialog_Setup; -class Dialog_Gradient; -class Dialog_Color; -class Dialog_ToolOptions; -class DeviceTracker; -class AutoRecover; - -class DockManager; - -class Dock_History; -class Dock_Canvases; - -class Dock_Keyframes; -class Dock_Params; -class Dock_Layers; -class Dock_MetaData; -class Dock_Children; -class Dock_Info; -class Dock_Navigator; -class Dock_LayerGroups; -class IPC; - -class Module; - -class StateManager; -class IconController; - -class App : public Gtk::Main, private IconController -{ - friend class Preferences; - friend class Dialog_Setup; - - /* - -- ** -- P U B L I C T Y P E S --------------------------------------------- - */ - -public: - - struct Busy - { - static int count; - Busy(){count++;} - ~Busy(){count--;} - }; - - - /* - -- ** -- P R I V A T E D A T A --------------------------------------------- - */ - -private: - //static etl::handle ui_interface_; - //static int max_recent_files; - -/* //declated as globals in app.cpp - static Dock_Keyframes *dock_keyframes; - static Dock_Layers *dock_layers; - static Dock_Params *dock_params; - static Dock_MetaData *dock_meta_data; - static Dock_Children *dock_children; - static Dock_Info *dock_info; - static Dock_Navigator *dock_navigator; - static Dock_History *dock_history; - static Dock_Canvases *dock_canvases; - static Dock_LayerGroups *dock_layer_groups; - - static IPC *ipc; -*/ - - etl::smart_ptr synfigapp_main; - - - static etl::handle selected_instance; - static etl::handle selected_canvas_view; - - static Glib::RefPtr ui_manager_; - -// static std::list< etl::handle< Module > > module_list_; - - /* - -- ** -- P U B L I C D A T A ----------------------------------------------- - */ - -public: - static Gtk::InputDialog* dialog_input; - - static DeviceTracker* device_tracker; - static AutoRecover* auto_recover; - static DockManager* dock_manager; - - static DockManager* get_dock_manager() { return dock_manager; } - - static Dialog_Setup* dialog_setup; - static Dialog_Gradient* dialog_gradient; - static Dialog_Color* dialog_color; -// static Dialog_Palette* dialog_palette; - static Dialog_ToolOptions *dialog_tool_options; - - static synfig::Distance::System distance_system; - - static synfig::Gamma gamma; - - static About *about; - static Toolbox *toolbox; - - static std::list > instance_list; - - static bool shutdown_in_progress; - - static bool use_colorspace_gamma; - -#ifdef SINGLE_THREADED - static bool single_threaded; -#endif - - static bool restrict_radius_ducks; - static bool resize_imported_images; - - static synfig::String browser_command; - static synfig::String custom_filename_prefix; - static int preferred_x_size; - static int preferred_y_size; - static synfig::String predefined_size; - static synfig::String predefined_fps; - static float preferred_fps; - /* - -- ** -- S I G N A L S ------------------------------------------------------- - */ -/* //declated as globals in app.cpp - static sigc::signal< - void, - etl::loose_handle - > signal_canvas_view_focus_; - static sigc::signal< - void, - etl::handle - > signal_instance_selected_; - static sigc::signal< - void, - etl::handle - > signal_instance_created_; - static sigc::signal< - void, - etl::handle - > signal_instance_deleted_; - static sigc::signal signal_recent_files_changed_; - static sigc::signal signal_present_all_; -*/ -public: - - static sigc::signal &signal_present_all(); - - static sigc::signal &signal_recent_files_changed(); - - static sigc::signal< - void, - etl::loose_handle - >& signal_canvas_view_focus(); - - static sigc::signal< - void, - etl::handle - > &signal_instance_selected(); - - static sigc::signal< - void, - etl::handle - > &signal_instance_created(); - - static sigc::signal< - void, - etl::handle - > &signal_instance_deleted(); - - /* - -- ** -- P R I V A T E M E T H O D S --------------------------------------- - */ - -private: - static void add_recent_file(const std::string &filename, const std::string &window_size = std::string()); - - /* - -- ** -- P U B L I C M E T H O D S ----------------------------------------- - */ - -public: - - App(int *argc, char ***argv); - virtual ~App(); - - /* - -- ** -- S T A T I C P U B L I C M E T H O D S --------------------------- - */ - -public: - - static StateManager* get_state_manager(); - - static Glib::RefPtr& ui_manager() { return ui_manager_; } - - static void set_recent_file_window_size(etl::handle instance); - static void add_recent_file(const etl::handle instance); - - static synfig::String get_base_path(); - static void save_settings(); - static void load_settings(); - static void reset_initial_window_configuration(); - - static const std::list& get_recent_files(); - - static const etl::handle& get_ui_interface(); - - - static void set_selected_instance(etl::loose_handle instance); - static void set_selected_canvas_view(etl::loose_handle); - - static etl::loose_handle get_instance(etl::handle canvas); - - static etl::loose_handle get_selected_instance() { return selected_instance; } - static etl::loose_handle get_selected_canvas_view() { return selected_canvas_view; } - - static bool open(std::string filename); - - static bool open_as(std::string filename,std::string as); - - static void new_instance(); - - static void dialog_open(std::string filename = ""); - - static void dialog_about(); - - static void quit(); - - static void show_setup(); - - static void undo(); - static void redo(); - - static int get_max_recent_files(); - static void set_max_recent_files(int x); - - - static synfig::Time::Format get_time_format(); - static void set_time_format(synfig::Time::Format x); - - static bool shutdown_request(GdkEventAny*bleh=NULL); - -// static bool dialog_file(const std::string &title, std::string &filename); - - static bool dialog_open_file(const std::string &title, std::string &filename, std::string preference); - static bool dialog_save_file(const std::string &title, std::string &filename, std::string preference); - - static void dialog_error_blocking(const std::string &title, const std::string &message); - - static void dialog_warning_blocking(const std::string &title, const std::string &message); - - static bool dialog_entry(const std::string &title, const std::string &message,std::string &text); - static bool dialog_paragraph(const std::string &title, const std::string &message,std::string &text); - - static bool dialog_yes_no(const std::string &title, const std::string &message); - - static int dialog_yes_no_cancel(const std::string &title, const std::string &message); - - static void dialog_not_implemented(); - - static void dialog_help(); - - static void open_url(const std::string &url); - - static synfig::String get_user_app_directory(); - static synfig::String get_config_file(const synfig::String& file); -}; // END of class App - - void delete_widget(Gtk::Widget *widget); - -}; // END namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/asyncrenderer.cpp b/synfig-studio/src/gtkmm/asyncrenderer.cpp deleted file mode 100644 index 72a286c..0000000 --- a/synfig-studio/src/gtkmm/asyncrenderer.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file asyncrenderer.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007 Chris Moore -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "asyncrenderer.h" -#include "app.h" -#include -#include - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#ifdef HAVE_SYS_WAIT_H -#include -#endif - -#ifdef HAVE_SIGNAL_H -#include -#endif - -#include -#include - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -#define BOREDOM_TIMEOUT 50 - -#define REJOIN_ON_STOP 1 - -// The Glib::Dispatcher class is broken as of Glibmm 2.4.5. -// Defining this macro enables the workaround. -#define GLIB_DISPATCHER_BROKEN 1 - -/* === C L A S S E S ======================================================= */ - -class AsyncTarget_Tile : public synfig::Target_Tile -{ -public: - etl::handle warm_target; - - struct tile_t - { - Surface surface; - int x,y; - tile_t(const Surface& surface,int x, int y): - surface(surface), - x(x),y(y) - { - } - }; - std::list tile_queue; - Glib::Mutex mutex; - -#ifndef GLIB_DISPATCHER_BROKEN - Glib::Dispatcher tile_ready_signal; -#endif - Glib::Cond cond_tile_queue_empty; - bool alive_flag; - - sigc::connection ready_connection; - -public: - AsyncTarget_Tile(etl::handle warm_target): - warm_target(warm_target) - { - set_avoid_time_sync(warm_target->get_avoid_time_sync()); - set_tile_w(warm_target->get_tile_w()); - set_tile_h(warm_target->get_tile_h()); - set_canvas(warm_target->get_canvas()); - set_quality(warm_target->get_quality()); - set_remove_alpha(warm_target->get_remove_alpha()); - set_threads(warm_target->get_threads()); - set_clipping(warm_target->get_clipping()); - set_rend_desc(&warm_target->rend_desc()); - alive_flag=true; -#ifndef GLIB_DISPATCHER_BROKEN - ready_connection=tile_ready_signal.connect(sigc::mem_fun(*this,&AsyncTarget_Tile::tile_ready)); -#endif - } - - ~AsyncTarget_Tile() - { - ready_connection.disconnect(); - } - void set_dead() - { - Glib::Mutex::Lock lock(mutex); - alive_flag=false; - } - - virtual int total_tiles()const - { - return warm_target->total_tiles(); - } - - virtual int next_tile(int& x, int& y) - { - if(!alive_flag) - return 0; - - return warm_target->next_tile(x,y); - } - - virtual int next_frame(Time& time) - { - if(!alive_flag) - return 0; - return warm_target->next_frame(time); - } - - virtual bool start_frame(synfig::ProgressCallback *cb=0) - { - if(!alive_flag) - return false; - return warm_target->start_frame(cb); - } - - virtual bool add_tile(const synfig::Surface &surface, int gx, int gy) - { - assert(surface); - if(!alive_flag) - return false; - Glib::Mutex::Lock lock(mutex); - tile_queue.push_back(tile_t(surface,gx,gy)); - if(tile_queue.size()==1) - { -#ifdef GLIB_DISPATCHER_BROKEN - ready_connection=Glib::signal_timeout().connect( - sigc::bind_return( - sigc::mem_fun(*this,&AsyncTarget_Tile::tile_ready), - false - ) - ,0 - ); -#else - tile_ready_signal(); -#endif - } - - return alive_flag; - } - - void tile_ready() - { - Glib::Mutex::Lock lock(mutex); - if(!alive_flag) - { - tile_queue.clear(); - cond_tile_queue_empty.signal(); - return; - } - while(!tile_queue.empty() && alive_flag) - { - tile_t& tile(tile_queue.front()); - - if (getenv("SYNFIG_SHOW_TILE_OUTLINES")) - { - Color red(1,0,0); - tile.surface.fill(red, 0, 0, 1, tile.surface.get_h()); - tile.surface.fill(red, 0, 0, tile.surface.get_w(), 1); - } - - alive_flag=warm_target->add_tile(tile.surface,tile.x,tile.y); - - tile_queue.pop_front(); - } - cond_tile_queue_empty.signal(); - } - - virtual void end_frame() - { -#ifdef SINGLE_THREADED - if (!single_threaded()) - { -#endif - while(alive_flag) - { - Glib::Mutex::Lock lock(mutex); - if(!tile_queue.empty() && alive_flag) - { - if(cond_tile_queue_empty.timed_wait(mutex,Glib::TimeVal(0,BOREDOM_TIMEOUT))) - break; - } - else - break; - } -#ifdef SINGLE_THREADED - } -#endif - Glib::Mutex::Lock lock(mutex); - if(!alive_flag) - return; - return warm_target->end_frame(); - } -}; - - - -class AsyncTarget_Scanline : public synfig::Target_Scanline -{ -public: - etl::handle warm_target; - - int scanline_; - Surface surface; - - Glib::Mutex mutex; - -#ifndef GLIB_DISPATCHER_BROKEN - Glib::Dispatcher frame_ready_signal; -#endif - Glib::Cond cond_frame_queue_empty; - bool alive_flag; - bool ready_next; - sigc::connection ready_connection; - - -public: - AsyncTarget_Scanline(etl::handle warm_target): - warm_target(warm_target) - { - set_avoid_time_sync(warm_target->get_avoid_time_sync()); - set_canvas(warm_target->get_canvas()); - set_quality(warm_target->get_quality()); - set_remove_alpha(warm_target->get_remove_alpha()); - set_threads(warm_target->get_threads()); - set_rend_desc(&warm_target->rend_desc()); - alive_flag=true; -#ifndef GLIB_DISPATCHER_BROKEN - ready_connection=frame_ready_signal.connect(sigc::mem_fun(*this,&AsyncTarget_Scanline::frame_ready)); -#endif - surface.set_wh(warm_target->rend_desc().get_w(),warm_target->rend_desc().get_h()); - } - - ~AsyncTarget_Scanline() - { - ready_connection.disconnect(); - } - - virtual int next_frame(Time& time) - { - if(!alive_flag) - return 0; - return warm_target->next_frame(time); - - } - - void set_dead() - { - Glib::Mutex::Lock lock(mutex); - alive_flag=false; - } - - virtual bool start_frame(synfig::ProgressCallback */*cb*/=0) - { - return alive_flag; - } - - virtual void end_frame() - { - { - Glib::Mutex::Lock lock(mutex); - - if(!alive_flag) - return; - ready_next=false; - -#ifdef GLIB_DISPATCHER_BROKEN - ready_connection=Glib::signal_timeout().connect( - sigc::bind_return( - sigc::mem_fun(*this,&AsyncTarget_Scanline::frame_ready), - false - ) - ,0 - ); -#else - frame_ready_signal(); -#endif - } - -#ifdef SINGLE_THREADED - if (single_threaded()) - signal_progress()(); - else -#endif - while(alive_flag && !ready_next) - { - Glib::Mutex::Lock lock(mutex); - if(cond_frame_queue_empty.timed_wait(mutex,Glib::TimeVal(0,BOREDOM_TIMEOUT))) - break; - } - } - - - virtual Color * start_scanline(int scanline) - { - Glib::Mutex::Lock lock(mutex); - - return surface[scanline]; - } - - virtual bool end_scanline() - { - return alive_flag; - } - - void frame_ready() - { - Glib::Mutex::Lock lock(mutex); - if(alive_flag) - alive_flag=warm_target->add_frame(&surface); -#ifdef SINGLE_THREADED - if (!single_threaded()) -#endif - cond_frame_queue_empty.signal(); - ready_next=true; - } -}; - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -AsyncRenderer::AsyncRenderer(etl::handle target_,synfig::ProgressCallback *cb): - error(false), - success(false), - cb(cb) -#ifdef SINGLE_THREADED - , updating(false) -#endif -{ - render_thread=0; - if(etl::handle::cast_dynamic(target_)) - { - etl::handle wrap_target( - new AsyncTarget_Tile(etl::handle::cast_dynamic(target_)) - ); - - signal_stop_.connect(sigc::mem_fun(*wrap_target,&AsyncTarget_Tile::set_dead)); - - target=wrap_target; - } - else if(etl::handle::cast_dynamic(target_)) - { - etl::handle wrap_target( - new AsyncTarget_Scanline( - etl::handle::cast_dynamic(target_) - ) - ); - - signal_stop_.connect(sigc::mem_fun(*wrap_target,&AsyncTarget_Scanline::set_dead)); - - target=wrap_target; - } -} - -AsyncRenderer::~AsyncRenderer() -{ - stop(); -} - -void -AsyncRenderer::stop() -{ - if(target) - { - Glib::Mutex::Lock lock(mutex); - done_connection.disconnect(); - - if(render_thread) - { - signal_stop_(); - -#if REJOIN_ON_STOP -#ifdef SINGLE_THREADED - if (!single_threaded()) -#endif - render_thread->join(); -#endif - - // Make sure all the dispatch crap is cleared out - //Glib::MainContext::get_default()->iteration(false); - - if(success) - signal_success_(); - - signal_finished_(); - - target=0; - render_thread=0; - } - } -} - -void -AsyncRenderer::pause() -{ -} - -void -AsyncRenderer::resume() -{ -} - -void -AsyncRenderer::start() -{ - done_connection=Glib::signal_timeout().connect( - sigc::bind_return( - mem_fun(*this,&AsyncRenderer::start_), - false - ) - ,50 - ); -} - -#ifdef SINGLE_THREADED -void -AsyncRenderer::rendering_progress() -{ - updating = true; - while(studio::App::events_pending()) studio::App::iteration(false); - updating = false; -} -#endif - -void -AsyncRenderer::start_() -{ - error=false;success=false; - if(target) - { -#ifndef GLIB_DISPATCHER_BROKEN - done_connection=signal_done_.connect(mem_fun(*this,&AsyncRenderer::stop)); -#endif - -#ifdef SINGLE_THREADED - if (single_threaded()) - { - synfig::info("%s:%d rendering in the same thread", __FILE__, __LINE__); - target->signal_progress().connect(sigc::mem_fun(this,&AsyncRenderer::rendering_progress)); - render_thread = (Glib::Thread*)1; - render_target(); - } - else -#endif - { - render_thread=Glib::Thread::create( - sigc::mem_fun(*this,&AsyncRenderer::render_target), -#if REJOIN_ON_STOP - true -#else - false -#endif - ); - assert(render_thread); - } - } - else - { - stop(); - } -} - -void -AsyncRenderer::render_target() -{ - etl::handle target(AsyncRenderer::target); - - if(target && target->render()) - { - success=true; - } - else - { - error=true; -#ifndef REJOIN_ON_STOP - return; -#endif - } - - if(mutex.trylock()) - { -#ifdef GLIB_DISPATCHER_BROKEN - done_connection=Glib::signal_timeout().connect( - sigc::bind_return( - mem_fun(*this,&AsyncRenderer::stop), - false - ) - ,0 - ); -#else - signal_done_.emit(); -#endif - mutex.unlock(); - } -} diff --git a/synfig-studio/src/gtkmm/asyncrenderer.h b/synfig-studio/src/gtkmm/asyncrenderer.h deleted file mode 100644 index 7d865fd..0000000 --- a/synfig-studio/src/gtkmm/asyncrenderer.h +++ /dev/null @@ -1,123 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file asyncrenderer.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007 Chris Moore -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_ASYNCRENDERER_H -#define __SYNFIG_ASYNCRENDERER_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/* === M A C R O S ========================================================= */ - -// uncomment define SINGLE_THREADED to use a single thread, and hopefully get more stability (dooglus) - changed to be default if using windows (Nov 2009 pixelgeek) -#ifdef WIN32 -#define SINGLE_THREADED -#endif -#ifdef SINGLE_THREADED -# define single_threaded() App::single_threaded -#endif - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio { - -class AsyncRenderer : public etl::shared_object, public sigc::trackable -{ - sigc::signal signal_finished_; - sigc::signal signal_success_; - - std::list activity_connection_list; - - //etl::handle target_scanline; - //etl::handle target_tile; - etl::handle target; - - bool error; - bool success; - - synfig::ProgressCallback *cb; - - sigc::signal signal_stop_; - - Glib::Thread* render_thread; - Glib::Dispatcher signal_done_; - Glib::Mutex mutex; - sigc::connection done_connection; - - /* - -- ** -- P A R E N T M E M B E R S ----------------------------------------- - */ -public: - - AsyncRenderer(etl::handle target,synfig::ProgressCallback *cb=0); - virtual ~AsyncRenderer(); - - void start(); - void stop(); - void pause(); - void resume(); -#ifdef SINGLE_THREADED - void rendering_progress(); - bool updating; -#endif - - bool has_error()const { return error; } - bool has_success()const { return success; } - - sigc::signal& signal_finished() { return signal_finished_; } - sigc::signal& signal_success() { return signal_success_; } - -private: - - void render_target(); - void start_(); - - /* - -- ** -- C H I L D M E M B E R S ------------------------------------------- - */ - -protected: - -}; - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/audiocontainer.cpp b/synfig-studio/src/gtkmm/audiocontainer.cpp deleted file mode 100644 index 70d5dd9..0000000 --- a/synfig-studio/src/gtkmm/audiocontainer.cpp +++ /dev/null @@ -1,1429 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file audiocontainer.cpp -** \brief Audio Container implementation File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include -#include -//#include -#include - -#include - -#include - -#include "audiocontainer.h" - -#include -#include -#include - -#include -#include - -#ifdef WITH_FMOD -#include -#endif - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; - -/* === M A C R O S ========================================================= */ -#ifdef __WIN32 -#else //linux... -#define AUDIO_OUTPUT FSOUND_OUTPUT_OSS -#endif - -/* === G L O B A L S ======================================================= */ -const double delay_factor = 3; - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -/* === E N T R Y P O I N T ================================================= */ - -//Help constructing stuff -struct FSOUND_SAMPLE; -using studio::AudioContainer; - -#ifdef WITH_FMOD -bool build_profile(FSOUND_SAMPLE *sample, double &samplerate, std::vector &samples) -#else -bool build_profile(FSOUND_SAMPLE */*sample*/, double &/*samplerate*/, std::vector &/*samples*/) -#endif -{ -#ifdef WITH_FMOD - - float sps = samplerate; - - //trivial rejection... - if(!sample || sps < 1) - { - synfig::warning("build_profile: Sample rate was too low or sample was invalid"); - return false; - } - - //lock for all samples and process them into a subset - unsigned int mode = FSOUND_Sample_GetMode(sample); - - //make sure that it's 8 bit... I hope this works... - - //sample rate of the actual song... - int allsamplerate = 0; - FSOUND_Sample_GetDefaults(sample,&allsamplerate,0,0,0); - - //get the size of the sample defaults from the mode - int channels = 1; - int channelsize = 1; //number of bytes - - if(mode & FSOUND_16BITS) channelsize = 2; //this shouldn't happen - if(mode & FSOUND_STEREO) channels = 2; - - //Get the sample information - int samplesize = channels*channelsize; //the only two things that increase samplesize - int numsamples = FSOUND_Sample_GetLength(sample); //number of samples in the sound - int sizeall = samplesize*numsamples; //should be the size of the entire song... - - if(sizeall <= 0) - { - synfig::warning("ProfileAudio: Sample buffer cannot be size smaller than 1 (%X)",FSOUND_GetError()); - return false; - } - - //be sure that the new sample rate is less than or equal to the original - if(sps > allsamplerate) sps = allsamplerate; - - float stride = allsamplerate/(float)sps; - - //down sampling to 8 bit min/max values - synfig::warning("About to downsample from %d Hz to %.1f Hz, sample stride: %f", allsamplerate, sps, stride); - - char *sampledata=0,*useless = 0; - unsigned int len1,len2; - // vector samples; - { - if(!FSOUND_Sample_Lock(sample,0,sizeall,(void**)&sampledata,(void**)&useless,&len1,&len2)) - { - synfig::warning("ProfileAudio: Unable to lock the sound buffer... (%X)",FSOUND_GetError()); - return false; - } - synfig::warning("Locked: %X: %d bytes, %X: %d bytes",sampledata,len1,useless,len2); - - if(channelsize == 1) - { - //process the data - char *iter = sampledata; - char *end = iter + sizeall; - - float curaccum = 0; - float numinc = sps/(float)allsamplerate; - - /* Loop per sample DDA alg. - */ - - int i = 0; - - //HACK - to prevent if statement inside inner loop - //synfig::warning("wo baby wo baby, inc: %d, stride: %f, size: %d", inc, stride, sizeall); - while(iter < end) - { - int maxs = 0, mins = 0; - - for(;curaccum < 1; curaccum += numinc) - { - for(i = 0; iter < end && i < channels; ++i, iter += channelsize) - { - maxs = std::max(maxs,(int)*iter); - mins = std::min(mins,(int)*iter); - } - } - //insert onto new list - samples.push_back(maxs); - samples.push_back(mins); - - //and flush all the used samples for curaccum - curaccum -= 1; - } - }else if(channelsize == 2) - { - //process the data - char *iter = sampledata; - char *end = iter + sizeall; - - float curaccum = 0; - float numinc = sps/(float)allsamplerate; - - /* Loop per sample DDA alg. - */ - - int i = 0; - - //HACK - to prevent if statement inside inner loop - //synfig::warning("wo baby wo baby, inc: %d, stride: %f, size: %d", inc, stride, sizeall); - while(iter < end) - { - int maxs = 0, mins = 0; - - for(;curaccum < 1; curaccum += numinc) - { - for(i = 0; iter < end && i < channels; ++i, iter += channelsize) - { - maxs = std::max(maxs,(int)*(short*)iter); - mins = std::min(mins,(int)*(short*)iter); - } - } - //insert onto new list - samples.push_back(maxs / 256); - samples.push_back(mins / 256); - - //and flush all the used samples for curaccum - curaccum -= 1; - } - } - } - - synfig::warning("Stats: %f seconds with %d bytes now %d bytes", (samples.size()/2)/sps, sizeall, samples.size()); - synfig::warning(" %f seconds before", numsamples/(float)allsamplerate); - - //we're done yay!, unlock - FSOUND_Sample_Unlock(sample,sampledata,useless,len1,len2); - synfig::info("Unlocked"); - - //FSOUND_PlaySound(FSOUND_FREE,sound); //test - - //we're done - samplerate = sps*2; //it must be x2 because we are sampling max and min - - return true; - - #else - - return false; - - #endif -} - - -//FMOD Systemwide Specific data mostly here... - -struct scrubinfo; - -#ifdef WITH_FMOD -static double buffer_length_sec = 0; - -//------- Scrubbing -------------- -/* Scrubbing works as follows: - - The sound is played using PlaySoundEx - we specify a user created DSP for scrubbing - set it initially to inactive - - When the program initiates it - we set the initial data in the shared structure and activate the dsp unit - then for each cursor update we get we set the value in the shared structure -*/ - -/* Things to check: - If IsPlaying just governs the channel play/stop value or if it also concerns the pause state - -*/ - -//so we can know where to create all this stuff -struct scrubinfo -{ - /* Linearly fit the frequency to hit the desired zero point... - */ - /*struct scrubelement - { - double pos; - double dt; - //the amount of time left til the cursor hits this one - // it's incremental so that the cursor must pass previous - // ones before decrementing this value - }; - */ - - //the time it should take to get to the next position... - - //to prevent from writing to the same location at once... (pos, deltatime, delaystart) - //Glib::Mutex lock; - - //the queue system would provide a more accurate representation... - volatile double pos; - volatile double deltatime; - - volatile double delaystart; //the amount of time we need to go before we start interpolating... - - volatile int channel; - - /*std::list queue; - - volatile int channel; - - //current position is FSOUND_GetCurrentPosition and current time is always 0... - - void add(const scrubelement &elem) - { - lock.LockWrite(); - - queue.push_back(elem); - - lock.UnlockWrite(); - } - - //Function to safely get rid of all the old samples (dt < 0) - void flush() - { - lock.LockWrite(); - - while(queue.size() && queue.front().dt < 0) - { - queue.pop_front(); - } - - lock.UnlockWrite(); - }*/ - - void Lock() - { - //lock.lock(); - } - - void Unlock() - { - //lock.unlock(); - } - - //All parameters and state should be set by the time we get here... - void scrub_dsp_process() - { - const double epsilon = 1e-5; - - //Trivial reject... we go nowhere if we aren't playing (hit boundary...) - if(!FSOUND_IsPlaying(channel)) return; - - //Get rid of all the old samples - //flush(); - - //Trivial reject #2 - We also go nowhere with no future samples (pause) - /*if(queue.size() <= 0) - { - FSOUND_SetPaused(channel,true); - return; - }*/ - - double dt = buffer_length_sec; - - //Lock ourselves so we don't die - Lock(); - - //printf("DSP data: delay = %.3f s, pos = %d, dt = %.3f\n", delaystart, (int)pos, deltatime); - - //Check delay - if(delaystart > 0) - { - delaystart -= dt; - - if(delaystart < 0) - { - dt = -delaystart; //add time back... - delaystart = 0; - } - } - - //Trivial reject for if we're past current sample... - if(delaystart > 0 || deltatime <= 0) - { - FSOUND_SetPaused(channel,true); - Unlock(); - return; - } - - //Calculate stretched frequency based on delayed future sample... - - //NOTE: BY NOT TRACKING POSITION AS A FLOAT AND JUST USING THE SOUNDS VALUE - // WE ARE LOSING A TINY AMOUNT OF PRECISION ACCURACY EVERY UPDATE - // (THIS SHOULDN'T BE A PROBLEM) - const double p0 = FSOUND_GetCurrentPosition(channel); - double curdp = 0; - - if(!FSOUND_GetPaused(channel)) - { - curdp = FSOUND_GetFrequency(channel) * deltatime; - } - - //need to rescale derivative... - - //Extrapolate from difference in position and deltatime vs dt... - const double pa = p0 + curdp/2; - - const double p1 = pos; - - //const double pb = p0/3 + p1*2/3; - - //will extrapolate if needed... (could be funky on a curve) - double t = 0; - if(deltatime > epsilon) - { - t = dt / deltatime; - } - - //Decrement deltatime (we may have gone past but that's what happens when we don't get input...) - deltatime -= dt; - - //we don't need to look at the current variables anymore... - Unlock(); - - const double invt = 1-t; - //double deltapos = (p1-p0)*t; //linear version - double deltapos = invt*invt*p0 + 2*t*invt*pa + t*t*p1 - p0; //quadratic smoothing version - - //Attempted cubic smoothing - //const double invt2 = invt*invt; - //const double t2 = t*t; - //double deltapos = invt2*invt*p0 + 3*t*invt2*pa + 3*t2*invt*pb + t2*t*p1; - //double deltapos = p0 + t*(3*(pa-p0) + t*(3*(p0+2*pa+pb) + t*((p1-3*pb+3*ba-p0)))); //unwound cubic - - //printf("\ttime = %.2f; p(%d,%d,%d) dp:%d - delta = %d\n",t,(int)p0,(int)p1,(int)p2,(int)curdp,(int)deltapos); - - //Based on the delta info calculate the stretched frequency - const int dest_samplesize = FSOUND_DSP_GetBufferLength(); - - //rounded to nearest frequency... (hopefully...) - int freq = (int)(deltapos * FSOUND_GetOutputRate() / (double)dest_samplesize); - - //NOTE: WE MIGHT WANT TO DO THIS TO BE MORE ACCURATE BUT YEAH... ISSUES WITH SMALL NUMBERS - //double newdp = deltapos / t; - - //printf("\tfreq = %d Hz\n", freq); - - // !If I failed... um assume we have to pause it... ? - if(abs(freq) < 100) - { - FSOUND_SetPaused(channel,true); - }else - { - //synfig::info("DSP f = %d Hz", freq); - FSOUND_SetPaused(channel,false); - if(!FSOUND_SetFrequency(channel,freq)) - { - //ERROR WILL ROBINSON!!!... - printf("Error in Freq... what do I do?\n"); - } - } - } -}; - -struct scrubuserdata -{ - /* //for use with multiple - //each one is a 'handle' to a pointer that will be effected by something else - typedef scrubinfo** value_type; - typedef std::set< value_type > scrubslist; - scrubslist scrubs; - - //so we can lock access to the list... - ReadWriteLock lock; - - void AddScrub(scrubinfo **i) - { - lock.LockWrite(); - scrubs.insert(i); - lock.UnLockWrite(); - } - - void RemoveScrub(scrubinfo **i) - { - lock.LockWrite(); - scrubs.erase(i); - lock.UnLockWrite(); - }*/ - - scrubinfo * volatile * scrub; -}; - -//Scrubbing data structures -static const int default_scrub_priority = 5; //between clear and sfx/music mix -static scrubuserdata g_scrubdata = {0}; -static FSOUND_DSPUNIT *scrubdspunit = 0; - -void * scrubdspwrap(void *originalbuffer, void *newbuffer, int length, void *userdata) -{ - //std::string dsp = "DSP"; - if(userdata) - { - scrubuserdata &sd = *(scrubuserdata*)userdata; - - /* //For use with multiple scrubs... - //Lock so no one can write to it while we're reading from it... - sd.lock.LockRead(); - - //make a copy of it... - std::vector v(sd.scrubs.begin(),sd.scrubs.end()); - - //other things can do stuff with it again... - sd.lock.UnLockRead(); - - //loop through the list and process all the active scrub units - std::vector::iterator i = v.begin(), - end = v.end(); - for(;i != end; ++i) - { - //check to make sure this object is active... - if(*i && **i) - { - (**i)->scrub_dsp_process(); - } - } - */ - - if(sd.scrub && *sd.scrub) - { - //dsp += " processing..."; - scrubinfo * info = (*sd.scrub); - info->scrub_dsp_process(); - } - } - - //synfig::info(dsp); - - return newbuffer; -} - -//------- Class for loading fmod on demand ------- - -class FMODInitializer -{ - bool loaded; - int refcount; - -public: - FMODInitializer():loaded(false),refcount(0) {} - ~FMODInitializer() - { - clear(); - } - - void addref() - { - if(!loaded) - { - #ifdef WITH_FMOD - synfig::info("Initializing FMOD on demand..."); - - { - FSOUND_SetOutput(AUDIO_OUTPUT); - - /*int numdrivers = FSOUND_GetNumDrivers(); - synfig::info("Num FMOD drivers = %d",numdrivers); - synfig::info("Current Driver is #%d", FSOUND_GetDriver()); - - for(int i = 0; i < numdrivers; ++i) - { - unsigned int caps = 0; - FSOUND_GetDriverCaps(i,&caps); - - synfig::info(" Caps for driver %d (%s) = %x",i,FSOUND_GetDriverName(i),caps); - } - - FSOUND_SetDriver(0);*/ - - //Modify buffer size... - //FSOUND_SetBufferSize(100); - - if(!FSOUND_Init(44100, 32, 0)) - { - synfig::warning("Unable to load FMOD"); - }else - { - loaded = true; - - //Create the DSP for processing scrubbing... - scrubdspunit = FSOUND_DSP_Create(&scrubdspwrap,default_scrub_priority,&g_scrubdata); - - //Load the number of sec per buffer into the global variable... - buffer_length_sec = FSOUND_DSP_GetBufferLength() / (double)FSOUND_GetOutputRate(); - } - } - #endif - } - - //add to the refcount - ++refcount; - //synfig::info("Audio: increment fmod refcount %d", refcount); - } - - void decref() - { - if(refcount <= 0) - { - synfig::warning("FMOD refcount is already 0..."); - }else - { - --refcount; - //synfig::info("Audio: decrement fmod refcount %d", refcount); - - //NOTE: UNCOMMENT THIS IF YOU WANT FMOD TO UNLOAD ITSELF WHEN IT ISN'T NEEDED ANYMORE... - flush(); - } - } - - bool is_loaded() const { return loaded; } - - void clear() - { - refcount = 0; - flush(); - } - - void flush() - { - if(loaded && refcount <= 0) - { - #ifdef WITH_FMOD - synfig::info("Unloading FMOD"); - if(scrubdspunit) FSOUND_DSP_Free(scrubdspunit); - FSOUND_Close(); - #endif - loaded = false; - } - } -}; - -//The global counter for FMOD.... -FMODInitializer fmodinit; - -#endif - -//----- AudioProfile Implementation ----------- -void studio::AudioProfile::clear() -{ - samplerate = 0; - samples.clear(); -} - -handle studio::AudioProfile::get_parent() const -{ - return parent; -} - -void studio::AudioProfile::set_parent(etl::handle i) -{ - parent = i; -} - -double studio::AudioProfile::get_offset() const -{ - if(parent) - return parent->get_offset(); - return 0; -} - -//---------- AudioContainer definitions --------------------- - -struct studio::AudioContainer::AudioImp -{ - //Sample load time information - FSOUND_SAMPLE * sample; - int channel; - int sfreq; - int length; - - //Time information - double offset; //time offset for playing... - - //We don't need it now that we've adopted the play(t) time schedule... - //current time... and playing info.... - //float seekpost; - //bool useseekval; - - //Make sure to sever our delayed start if we are stopped prematurely - sigc::connection delaycon; - - //Action information - bool playing; - double curscrubpos; - etl::clock timer; //for getting the time diff between scrub input points - - //Scrubbing information... - //the current position of the sound will be sufficient for normal stuff... - #ifdef WITH_FMOD - scrubinfo scrinfo; - #endif - - scrubinfo *scrptr; - - bool is_scrubbing() const {return scrptr != 0;} -#ifdef WITH_FMOD - void set_scrubbing(bool s) -#else - void set_scrubbing(bool /*s*/) -#endif - { - #ifdef WITH_FMOD - if(s) - scrptr = &scrinfo; - else - #endif - scrptr = 0; - } - - //helper to make sure we are actually playing (and to get a new channel...) - bool init_play() - { - #ifdef WITH_FMOD - if(!FSOUND_IsPlaying(channel)) - { - if(sample) - { - //play sound paused etc. - channel = FSOUND_PlaySoundEx(FSOUND_FREE,sample,0,true); - if(channel < 0 || FSOUND_GetError() != FMOD_ERR_NONE) - { - synfig::warning("Could not play the sample..."); - return false; - } - } - }else - { - FSOUND_SetPaused(channel,true); - FSOUND_SetFrequency(channel,sfreq); - } - return true; - - #else - - return false; - - #endif - } - -public: //structors - AudioImp() - :sample(0), - channel(0), - sfreq(0), - length(0), - offset(0), - playing(false), - scrptr(0) - { - //reuse the channel... - #ifdef WITH_FMOD - channel = FSOUND_FREE; - #endif - } - - ~AudioImp() - { - clear(); - } - -public: //helper/accessor funcs - bool start_playing_now() //callback for timer... - { - #ifdef WITH_FMOD - if(playing) - { - //Make sure the sound is playing and if it is un pause it... - if(init_play()) - FSOUND_SetPaused(channel,false); - } - #endif - - return false; //so the timer doesn't repeat itself - } - - bool isRunning() - { - #ifdef WITH_FMOD - return FSOUND_IsPlaying(channel); - #else - return false; - #endif - } - - bool isPaused() - { -#ifdef WITH_FMOD - return FSOUND_GetPaused(channel); -#else - return false; -#endif - } - - -public: //forward interface - - //Accessors for the offset - in seconds - const double &get_offset() const {return offset;} - void set_offset(const double &d) - { - offset = d; - } - - //Will override the parameter timevalue if the sound is running, and not if it's not... -#ifdef WITH_FMOD - bool get_current_time(double &out) -#else - bool get_current_time(double &/*out*/) -#endif - { - if(isRunning()) - { - #ifdef WITH_FMOD - unsigned int pos = FSOUND_GetCurrentPosition(channel); - - //adjust back by 1 frame... HACK.... - //pos -= FSOUND_DSP_GetBufferLength(); - - //set the position - out = pos/(double)sfreq + offset; - #endif - - return true; - } - return false; - } - - //Big implementation functions... - bool load(const std::string &filename, const std::string &filedirectory); - void clear(); - - //playing functions - void play(double t); - void stop(); - - //scrubbing functions - void start_scrubbing(double t); - void scrub(double t); - void stop_scrubbing(); - - double scrub_time() - { - return curscrubpos; - } -}; - -//--------------- Audio Container definitions -------------------------- -studio::AudioContainer::AudioContainer() -{ - imp = 0; -} - -studio::AudioContainer::~AudioContainer() -{ - if(imp) delete (imp); -} - -bool studio::AudioContainer::load(const std::string &filename,const std::string &filedirectory) -{ - if(!imp) - { - imp = new AudioImp; - } - - profilevalid = false; - return imp->load(filename,filedirectory); -} - -#ifdef WITH_FMOD -handle studio::AudioContainer::get_profile(float samplerate) -#else -handle studio::AudioContainer::get_profile(float /*samplerate*/) -#endif -{ - #ifdef WITH_FMOD - - //if we already have done our work, then we're good - if(profilevalid && prof) - { - //synfig::info("Using already built profile"); - return prof; - } - - //synfig::info("Before profile"); - //make a new profile at current sample rate - - //NOTE: We might want to reuse the structure already there... - prof = new AudioProfile; - prof->set_parent(this); //Our parent is THIS!!! - - if(!prof) - { - synfig::warning("Couldn't allocate audioprofile..."); - return handle(); - } - - //setting the info for the sample rate - //synfig::info("Setting info..."); - - synfig::info("Building Profile..."); - prof->samplerate = samplerate; - if(build_profile(imp->sample,prof->samplerate,prof->samples)) - { - synfig::info(" Success!"); - profilevalid = true; - return prof; - }else - { - return handle(); - } - - #else - - return handle(); - - #endif -} - -void studio::AudioContainer::clear() -{ - if(imp) - { - delete imp; - imp = 0; - } - - profilevalid = false; -} - -void studio::AudioContainer::play(double t) -{ - if(imp) imp->play(t); -} - -void studio::AudioContainer::stop() -{ - if(imp) imp->stop(); -} - -bool studio::AudioContainer::get_current_time(double &out) -{ - if(imp) return imp->get_current_time(out); - else return false; -} - -void AudioContainer::set_offset(const double &s) -{ - if(imp) imp->set_offset(s); -} - -double AudioContainer::get_offset() const -{ - static double zero = 0; - if(imp) - return imp->get_offset(); - return zero; -} - -bool AudioContainer::is_playing() const -{ - if(imp) - return imp->playing; - return false; -} - -bool AudioContainer::is_scrubbing() const -{ - if(imp) - return imp->is_scrubbing(); - return false; -} - -void AudioContainer::start_scrubbing(double t) -{ - if(imp) imp->start_scrubbing(t); -} - -void AudioContainer::stop_scrubbing() -{ - if(imp) imp->stop_scrubbing(); -} - -void AudioContainer::scrub(double t) -{ - if(imp) imp->scrub(t); -} - -double AudioContainer::scrub_time() const -{ - if(imp) return imp->scrub_time(); - else return 0; -} - -bool AudioContainer::isRunning() const -{ - if(imp) return imp->isRunning(); - else return false; -} - -bool AudioContainer::isPaused() const -{ - if(imp) return imp->isPaused(); - else return false; -} - -//----------- Audio imp information ------------------- - -#ifdef WITH_FMOD -bool studio::AudioContainer::AudioImp::load(const std::string &filename, - const std::string &filedirectory) -#else -bool studio::AudioContainer::AudioImp::load(const std::string &/*filename*/, - const std::string &/*filedirectory*/) -#endif -{ - clear(); - - #ifdef WITH_FMOD - - //And continue with the sound loading... - string file = filename; - - //Trivial reject... (fixes stat call problem... where it just looks at directory and not file...) - if(file.length() == 0) return false; - - //we don't need the file directory? - if(!is_absolute_path(file)) - { - file=filedirectory+filename; - synfig::warning("Not absolute hoooray"); - } - synfig::info("Loading Audio file: %s", file.c_str()); - - //check to see if file exists - { - struct stat s; - if(stat(file.c_str(),&s) == -1 && errno == ENOENT) - { - synfig::info("There was no audio file..."); - return false; - } - } - - //load fmod if we can... - //synfig::warning("I'm compiled with FMOD!"); - fmodinit.addref(); - - //load the stream - int ch = FSOUND_FREE; - FSOUND_SAMPLE *sm = FSOUND_Sample_Load(FSOUND_FREE,file.c_str(),FSOUND_LOOP_OFF|FSOUND_MPEGACCURATE,0,0); - - if(!sm) - { - synfig::warning("Could not open the audio file as a sample: %s",file.c_str()); - goto error; - } - - //synfig::warning("Opened a file as a sample! :)"); - - /*{ - int bufferlen = FSOUND_DSP_GetBufferLength(); - synfig::info("Buffer length = %d samples, %.3lf s",bufferlen, bufferlen / (double)FSOUND_GetOutputRate()); - }*/ - - //set all the variables since everything has worked out... - //get the length of the stream - { - length = FSOUND_Sample_GetLength(sm); - - int volume = 0; - FSOUND_Sample_GetDefaults(sm,&sfreq,&volume,0,0); - - //double len = length / (double)sfreq; - //synfig::info("Sound info: %.2lf s long, %d Hz, %d Vol",(double)length,sfreq,volume); - } - - //synfig::warning("Got all info, and setting up everything, %.2f sec.", length); - //synfig::warning(" BigSample: composed of %d samples", FSOUND_Sample_GetLength(sm)); - synfig::info("Successfully opened %s as a sample and initialized it.",file.c_str()); - - //set up the playable info - sample = sm; - channel = ch; - - //the length and sfreq params have already been initialized - - return true; - -error: - if(sm) FSOUND_Sample_Free(sm); - file = ""; - - fmodinit.decref(); - - return false; - - #else - return false; - #endif -} - -#ifdef WITH_FMOD -void studio::AudioContainer::AudioImp::play(double t) -#else -void studio::AudioContainer::AudioImp::play(double /*t*/) -#endif -{ - #ifdef WITH_FMOD - if(!sample) return; - - //stop scrubbing if we are... - if(is_scrubbing()) stop_scrubbing(); - - //t -= offset; - t -= get_offset(); - playing = true; - - if(t < 0) - { - unsigned int timeout = (int)floor(-t * 1000 + 0.5); - //synfig::info("Playing audio delayed by %d ms",timeout); - //delay for t seconds... - delaycon = Glib::signal_timeout().connect( - sigc::mem_fun(*this,&studio::AudioContainer::AudioImp::start_playing_now),timeout); - - init_play(); - FSOUND_SetFrequency(channel,sfreq); - FSOUND_SetCurrentPosition(channel,0); - return; - } - - unsigned int position = (int)floor(t*sfreq + 0.5); - - if(position >= FSOUND_Sample_GetLength(sample)) - { - synfig::warning("Can't play audio when past length..."); - return; - } - - init_play(); - FSOUND_SetFrequency(channel,sfreq); - FSOUND_SetCurrentPosition(channel,position); - FSOUND_SetPaused(channel,false); - - //synfig::info("Playing audio with position %d samples",position); - - #endif -} - -void studio::AudioContainer::AudioImp::stop() -{ - delaycon.disconnect(); - - #ifdef WITH_FMOD - if(fmodinit.is_loaded() && playing && isRunning()) - { - FSOUND_SetPaused(channel,true); - } - #endif - - playing = false; -} - -void studio::AudioContainer::AudioImp::clear() -{ - #ifdef WITH_FMOD - delaycon.disconnect(); - - stop(); - stop_scrubbing(); - - if(sample) - { - if(FSOUND_IsPlaying(channel)) - { - FSOUND_StopSound(channel); - } - channel = FSOUND_FREE; - FSOUND_Sample_Free(sample); - fmodinit.decref(); - } - - playing = false; - - #else - channel = 0; - #endif - - sample = 0; - playing = false; -} - -#ifdef WITH_FMOD -void studio::AudioContainer::AudioImp::start_scrubbing(double t) -#else -void studio::AudioContainer::AudioImp::start_scrubbing(double /*t*/) -#endif -{ - //synfig::info("Start scrubbing: %lf", t); - if(playing) stop(); - - set_scrubbing(true); - - #ifdef WITH_FMOD - //make sure the other one is not scrubbing... - if(g_scrubdata.scrub) - { - *g_scrubdata.scrub = 0; //nullify the pointer... - } - - //Set up the initial state for the delayed audio position - scrinfo.delaystart = 0; - scrinfo.pos = 0; - scrinfo.deltatime = 0; - - //set it to point to our pointer (dizzy...) - g_scrubdata.scrub = &scrptr; - - //setup position info so we can know what to do on boundary conditions... - curscrubpos = (t - get_offset()) * sfreq; - - //So we can get an accurate difference... - timer.reset(); - - //reposition the sound if it won't be when scrubbed (if it's already in the range...) - int curi = (int)curscrubpos; - if(curi >= 0 && curi < length) - { - init_play(); - FSOUND_SetCurrentPosition(channel,curi); - - //Set the values... - scrinfo.pos = curscrubpos; - scrinfo.delaystart = delay_factor*buffer_length_sec; - - //synfig::info("\tStarting at %d samps, with %d p %.3f delay", - // FSOUND_GetCurrentPosition(channel), (int)scrinfo.pos, scrinfo.delaystart); - } - - - - //enable the dsp... - //synfig::info("\tActivating DSP"); - FSOUND_DSP_SetActive(scrubdspunit,true); - #endif -} - -void studio::AudioContainer::AudioImp::stop_scrubbing() -{ - //synfig::info("Stop scrubbing"); - - if(is_scrubbing()) - { - set_scrubbing(false); - - #ifdef WITH_FMOD - g_scrubdata.scrub = 0; - - //stop the dsp... - //synfig::info("\tDeactivating DSP"); - FSOUND_DSP_SetActive(scrubdspunit,false); - if(FSOUND_IsPlaying(channel)) FSOUND_SetPaused(channel,true); - #endif - } - - curscrubpos = 0; -} - -#ifdef WITH_FMOD -void studio::AudioContainer::AudioImp::scrub(double t) -#else -void studio::AudioContainer::AudioImp::scrub(double /*t*/) -#endif -{ - #ifdef WITH_FMOD - //synfig::info("Scrub to %lf",t); - if(is_scrubbing()) - { - //What should we do? - - /* Different special cases - All outside, all inside, - coming in (left or right), - going out (left or right) - */ - double oldpos = curscrubpos; - double newpos = (t - get_offset()) * sfreq; - - curscrubpos = newpos; - - //Ok the sound is running, now we need to tweak it - if(newpos > oldpos) - { - //Outside so completely stopped... - if(newpos < 0 || oldpos >= length) - { - //synfig::info("\tOut +"); - if(FSOUND_IsPlaying(channel)) - { - FSOUND_SetPaused(channel,true); - } - - //Zero out the data! - scrinfo.Lock(); - scrinfo.delaystart = 0; - scrinfo.deltatime = 0; - scrinfo.Unlock(); - - return; - } - - //going in? - start the sound at the beginning... - /*else if(oldpos < 0) - { - //Set up the sound to be playing paused at the start... - init_play(); - FSOUND_SetCurrentPosition(channel,0); - - synfig::info("\tIn + %d", FSOUND_GetCurrentPosition(channel)); - - scrinfo.Lock(); - scrinfo.pos = 0; - scrinfo.delaystart = delay_factor*buffer_length_sec; - scrinfo.deltatime = 0; - scrinfo.Unlock(); - }*/ - //don't need to deal with leaving... automatically dealt with... - - else //We're all inside... - { - //Set new position and decide what to do with time... - scrinfo.Lock(); - scrinfo.pos = newpos; - - //should we restart the delay cycle... (is it done?) - if(!isRunning() || (scrinfo.delaystart <= 0 && scrinfo.deltatime <= 0 && isPaused())) - { - //synfig::info("Starting + at %d",(int)newpos); - scrinfo.deltatime = 0; - scrinfo.delaystart = delay_factor*buffer_length_sec; - scrinfo.Unlock(); - - //Set up the sound paused at the current position - init_play(); - int setpos = min(max((int)newpos,0),length); - FSOUND_SetCurrentPosition(channel,setpos); - timer.reset(); - return; - } - - //No! just increment the time delta... - scrinfo.deltatime += timer.pop_time(); - - //Nope... continue and just increment the deltatime and reset position... - scrinfo.Unlock(); - - //set channel and unpause - FSOUND_SetPaused(channel,false); - scrinfo.channel = channel; - - } - }else if(newpos < oldpos) - { - //completely stopped... - if(newpos >= length || oldpos < 0) - { - //synfig::info("Out -"); - if(FSOUND_IsPlaying(channel)) - { - FSOUND_SetPaused(channel,true); - } - - //Zero out the data! - scrinfo.Lock(); - scrinfo.delaystart = 0; - scrinfo.deltatime = 0; - scrinfo.Unlock(); - } - - //going in? - start going backwards at the end... - /*else if(oldpos >= length) - { - synfig::info("In -"); - //Set up the sound to be playing paused at the start... - init_play(); - FSOUND_SetCurrentPosition(channel,length-1); - - scrinfo.Lock(); - scrinfo.pos = length-1; - scrinfo.delaystart = delay_factor*buffer_length_sec; - scrinfo.deltatime = 0; - scrinfo.Unlock(); - }*/ - //we don't have to worry about the leaving case... - - else //We're all inside... - { - //Set new position and decide what to do with time... - scrinfo.Lock(); - scrinfo.pos = newpos; - - //should we restart the delay cycle... (is it done?) - if(!isRunning() ||(scrinfo.delaystart <= 0 && scrinfo.deltatime <= 0 && isPaused())) - { - //synfig::info("Starting - at %d",(int)newpos); - scrinfo.deltatime = 0; - scrinfo.delaystart = delay_factor*buffer_length_sec; - scrinfo.Unlock(); - - //reset timing so next update will be a valid diff... - init_play(); - int setpos = min(max((int)newpos,0),length); - FSOUND_SetCurrentPosition(channel,setpos); - timer.reset(); - return; - } - - //No! just increment the time delta... - scrinfo.deltatime += timer.pop_time(); - - //Nope... continue and just increment the deltatime and reset position... - scrinfo.Unlock(); - - //set channel and unpause - FSOUND_SetPaused(channel,false); - scrinfo.channel = channel; - } - } - } - #endif -} diff --git a/synfig-studio/src/gtkmm/audiocontainer.h b/synfig-studio/src/gtkmm/audiocontainer.h deleted file mode 100644 index 21d5f51..0000000 --- a/synfig-studio/src/gtkmm/audiocontainer.h +++ /dev/null @@ -1,139 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file audiocontainer.h -** \brief Sound info header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_AUDIOCONTAINER_H -#define __SYNFIG_AUDIOCONTAINER_H - -/* === H E A D E R S ======================================================= */ -#include - -#include - -#include -#include - -#include - -/* === M A C R O S ========================================================= */ -const float DEF_DISPLAYSAMPLERATE = 400; -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio { - -class AudioContainer; - -//Note: Might want to abstract something to share data between profile and parent -class AudioProfile : public etl::shared_object -{ -public: - typedef std::vector SampleProfile; - -private: - SampleProfile samples; - double samplerate; //samples / second of the profile - - //reference our parent for any native sound info - etl::loose_handle parent; - -public: //samples interface - - SampleProfile::const_iterator begin() const {return samples.begin();} - SampleProfile::const_iterator end() const {return samples.end();} - - void clear(); - unsigned int size() const {return samples.size();} - - char operator[](int i) const - { - if(i >= 0 && i < (int)samples.size()) return samples[i]; - else return 0; - } - -public: // - - double get_samplerate() const {return samplerate;} - void set_samplerate(double f) {samplerate = f;} - - double get_offset() const; - - etl::handle get_parent() const; - void set_parent(etl::handle i); - friend class AudioContainer; -}; - -/* Audio container actually implements all the cool stuff - Note: May be a bit too monolithic... -*/ -class AudioContainer : public sigc::trackable, public etl::shared_object -{ - etl::handle prof; - - struct AudioImp; - AudioImp *imp; - - bool profilevalid; //this is only half useful - //it makes it so we don't always have to realloc memory when the file switches... - -public: //structors - - AudioContainer(); - ~AudioContainer(); - -public: //accessor interface - void set_offset(const double &s); - double get_offset() const; - -public: //info gather interface - etl::handle get_profile(float samplerate = DEF_DISPLAYSAMPLERATE); - bool get_current_time(double &out); - -public: //operational interface - bool load(const std::string &filename, const std::string &filedirectory = ""); - void clear(); - - //play functions... - void play(double t); - void stop(); - //Note: this refers to the wrapper concept of the audio, the actual sound may or may not be playing... - bool is_playing() const; - - //scrubbing functions... - void start_scrubbing(double t); - void stop_scrubbing(); - void scrub(double t); //!< if we are not currently scrubbing this will not work - bool is_scrubbing() const; - - double scrub_time() const; - - bool isRunning() const; - bool isPaused() const; -}; - -} // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/autorecover.cpp b/synfig-studio/src/gtkmm/autorecover.cpp deleted file mode 100644 index 4e9eeb8..0000000 --- a/synfig-studio/src/gtkmm/autorecover.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file autorecover.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2008 Chris Moore -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "autorecover.h" - -#ifdef HAVE_SYS_ERRNO_H -#include -#endif -//#include -#include "app.h" -#include -#include -#include -#include -#include "instance.h" - -#ifdef HAVE_SYS_STAT_H -#include -#endif - -#ifdef HAVE_SYS_TIME_H -#include -#endif - -#ifdef HAVE_SYS_WAIT_H -#include -#endif - -#ifdef HAVE_SYS_RESOURCE_H -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -#ifdef _WIN32 -#define mkdir(x,y) mkdir(x) -#endif - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -AutoRecover::AutoRecover() -{ - // Three Minutes - set_timeout(3*60*1000); - - if(mkdir(get_shadow_directory().c_str(),ACCESSPERMS)<0) - { - if(errno!=EEXIST) - synfig::error("UNABLE TO CREATE \"%s\"",get_shadow_directory().c_str()); - } - else - { - synfig::info("Created directory \"%s\"",get_shadow_directory().c_str()); - } -} - -AutoRecover::~AutoRecover() -{ -} - -synfig::String -AutoRecover::get_shadow_directory() -{ - return Glib::build_filename(App::get_user_app_directory(),"tmp"); -} - -int -AutoRecover::pid() -{ -// return getpid(); - return 0; -} - -void -AutoRecover::set_timeout(int milliseconds) -{ - timeout=milliseconds; - auto_backup_connect.disconnect(); - if(timeout) - auto_backup_connect=Glib::signal_timeout().connect(sigc::ptr_fun(&AutoRecover::auto_backup),timeout); -} - -synfig::String -AutoRecover::get_shadow_file_name(const synfig::String& filename) -{ - unsigned int hash1(0xdeadbeef); - unsigned int hash2(0x83502529); - char* str_hash1(reinterpret_cast(&hash1)); - char* str_hash2(reinterpret_cast(&hash2)); - - // First we need to hash up the directory - { - String pool(dirname(filename)); - - while(pool.size()>4) - { - str_hash1[0]^=pool[1];str_hash1[1]^=pool[2];str_hash1[2]^=pool[3];str_hash1[3]^=pool[0]; - str_hash2[3]+=pool[0];str_hash2[2]+=pool[1];str_hash2[1]+=pool[2];str_hash2[0]+=pool[3]; - swap(hash1,hash2); - pool=String(pool,4,pool.size()); - } - while(pool.size()) - { - str_hash1[0]^=pool[0]; - str_hash1[2]^=pool[0]; - str_hash2[1]^=pool[0]; - str_hash2[3]^=pool[0]; - swap(hash1,hash2); - pool=String(pool,1,pool.size()); - } - } - hash1^=hash2; - - return Glib::build_filename(get_shadow_directory(),strprintf("%08X-%s",hash1,basename(filename).c_str())); - -// return dirname(filename) + ETL_DIRECTORY_SEPARATOR + ".shadow_" + basename(filename); -} - -bool -AutoRecover::cleanup_pid(int pid) -{ -#ifdef HAVE_FORK - int status=0; - if(waitpid(pid,&status,WNOHANG)==-1) - { - synfig::info("PID %d isn't a zombie yet",pid); - return true; - } - if(WEXITSTATUS(status)!=0) - { - synfig::error("Autobackup seems to have failed! (PID=%d)",pid); - } -// else -// synfig::info("PID=%d has been cleaned up",pid); -#endif - return false; -} - -bool -AutoRecover::auto_backup() -{ - int pid(0); - -#ifdef HAVE_FORK - pid=fork(); -#endif - - if(pid<=0) - { -#ifdef HAVE_SETPRIORITY - // make us low priority so that we don't - // cause the machine to slow down too much - setpriority(PRIO_PROCESS,0,15); -#endif - - try - { - std::list >::iterator iter; - - std::string filename=App::get_config_file("autorecovery"); - std::ofstream file(filename.c_str()); - - int savecount(0); - - for(iter=App::instance_list.begin();iter!=App::instance_list.end();++iter) - { - // If this file hasn't even been changed - // since it was last saved, then don't bother - // backing it up. - if((*iter)->get_action_count()==0) - continue; - - Canvas::Handle canvas((*iter)->get_canvas()); - file<get_file_name()<get_file_name()),canvas); - savecount++; - } - -// if(savecount) -// synfig::info("AutoRecover::auto_backup(): %d Files backed up.",savecount); - } - catch(...) - { - synfig::error("AutoRecover::auto_backup(): UNKNOWN EXCEPTION THROWN."); - synfig::error("AutoRecover::auto_backup(): FILES NOT BACKED UP."); - } - -#ifdef HAVE_FORK - if(pid==0) - { - _exit(0); - } -#endif - } - -#ifdef HAVE_FORK - Glib::signal_timeout().connect( - sigc::bind( - sigc::ptr_fun(&AutoRecover::cleanup_pid), - pid - ), - 60*1000 - ); -#endif - - // Also go ahead and save the settings - App::save_settings(); - - return true; -} - -bool -AutoRecover::recovery_needed()const -{ - std::string filename=App::get_config_file("autorecovery"); - std::ifstream file(filename.c_str()); - if(!file) - return false; - - while(file) - { - std::string filename; - getline(file,filename); - if(!filename.empty()) - return true; - } - - return false; -} - -bool -AutoRecover::recover(int& number_recovered) -{ - std::string filename=App::get_config_file("autorecovery"); - std::ifstream file(filename.c_str()); - number_recovered = 0; - if(!file) - return false; - bool success=true; - - while(file) - { - std::string filename; - getline(file,filename); - if(filename.empty()) - continue; - - // Open the file - if(App::open_as(get_shadow_file_name(filename),filename)) - { - // Correct the file name - App::instance_list.back()->set_file_name(filename); - - // This file isn't saved! mark it as such - App::instance_list.back()->inc_action_count(); - - number_recovered++; - } - else - success=false; - } - - return success; -} - -void -AutoRecover::normal_shutdown() -{ - // Turn off the timer - auto_backup_connect.disconnect(); - - std::string filename=App::get_config_file("autorecovery"); - remove(filename.c_str()); -} - -void -AutoRecover::clear_backup(synfig::Canvas::Handle canvas) -{ - if(canvas) - remove(get_shadow_file_name(canvas->get_file_name()).c_str()); -} diff --git a/synfig-studio/src/gtkmm/autorecover.h b/synfig-studio/src/gtkmm/autorecover.h deleted file mode 100644 index 9bdedac..0000000 --- a/synfig-studio/src/gtkmm/autorecover.h +++ /dev/null @@ -1,75 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file autorecover.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2008 Chris Moore -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_AUTORECOVER_H -#define __SYNFIG_AUTORECOVER_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio { - -class AutoRecover -{ - int timeout; - sigc::connection auto_backup_connect; -public: - AutoRecover(); - ~AutoRecover(); - - static int pid(); - static synfig::String get_shadow_file_name(const synfig::String& filename); - - static bool auto_backup(); - - static bool cleanup_pid(int pid); - - void set_timeout(int milliseconds); - int get_timeout()const { return timeout; } - - static synfig::String get_shadow_directory(); - - bool recovery_needed()const; - bool recover(int& number_recovered); - - void normal_shutdown(); - - void clear_backup(synfig::Canvas::Handle canvas); -}; // END of class AutoRecover - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/canvasoptions.cpp b/synfig-studio/src/gtkmm/canvasoptions.cpp deleted file mode 100644 index dfc15ed..0000000 --- a/synfig-studio/src/gtkmm/canvasoptions.cpp +++ /dev/null @@ -1,215 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasoptions.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "canvasoptions.h" -#include -#include -#include -#include -#include -#include "canvasview.h" -#include "workarea.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -CanvasOptions::CanvasOptions(etl::loose_handle canvas_view): - Gtk::Dialog(_("Canvas Options"),*canvas_view,false,true), - canvas_view_(canvas_view), - toggle_grid_snap(_("_Snap to grid"), true), - toggle_grid_show(_("S_how grid"), true), - toggle_time_snap(_("Snap to _frame"), true) -{ - vector_grid_size.set_canvas(canvas_view->get_canvas()); - - Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - dialogPadding->set_padding(12, 12, 12, 12); - - Gtk::Notebook *notebook=manage(new class Gtk::Notebook()); - dialogPadding->add(*notebook); - - toggle_grid_snap.signal_toggled().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_grid_snap_toggle)); - toggle_grid_show.signal_toggled().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_grid_show_toggle)); - - Gtk::Alignment *gridPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - gridPadding->set_padding(12, 12, 12, 12); - notebook->append_page(*gridPadding, _("Grid")); - - Gtk::VBox *gridBox = manage(new Gtk::VBox(false, 12)); - gridPadding->add(*gridBox); - - Gtk::Table *gridTable = manage(new Gtk::Table(3, 2, false)); - gridTable->set_row_spacings(6); - gridTable->set_col_spacings(12); - gridBox->pack_start(*gridTable, false, false, 0); - - Gtk::Label *gridSizeLabel = manage(new Gtk::Label(_("_Grid size"), true)); - gridSizeLabel->set_alignment(0, 0.5); - gridSizeLabel->set_mnemonic_widget(vector_grid_size); - - toggle_grid_show.set_alignment(0, 0.5); - toggle_grid_snap.set_alignment(0, 0.5); - - gridTable->attach(*gridSizeLabel, 0, 1, 0, 1, Gtk::SHRINK | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); - gridTable->attach(vector_grid_size, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); - gridTable->attach(toggle_grid_show, 0, 2, 1, 2, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); - gridTable->attach(toggle_grid_snap, 0, 2, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, 0, 0); - - Gtk::Alignment *timePadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - timePadding->set_padding(12, 12, 12, 12); - notebook->append_page(*timePadding, _("Time")); - - Gtk::VBox *timeBox = manage(new Gtk::VBox(false, 12)); - timePadding->add(*timeBox); - - timeBox->pack_start(toggle_time_snap, false, false, 0); - - Gtk::Alignment *unitPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - unitPadding->set_padding(12, 12, 12, 12); - notebook->append_page(*unitPadding, _("Units")); - unitPadding->add(*manage(new Gtk::Label(_("Not yet implemented!")))); - - Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); - ok_button->show(); - add_action_widget(*ok_button,2); - ok_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_ok_pressed)); - - Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); - apply_button->show(); - add_action_widget(*apply_button,1); - apply_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_apply_pressed)); - - Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); - cancel_button->show(); - add_action_widget(*cancel_button,0); - cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasOptions::on_cancel_pressed)); - - //set_default_response(1); - - - get_vbox()->pack_start(*dialogPadding); - get_vbox()->show_all(); - - signal_show().connect(sigc::mem_fun(*this, &studio::CanvasOptions::refresh)); - - vector_grid_size.set_digits(5); - - update_title(); -} - -CanvasOptions::~CanvasOptions() -{ -} - -void -CanvasOptions::update_title() -{ - set_title(_("Options")+String(" - ")+canvas_view_->get_canvas()->get_name()); -} - -void -CanvasOptions::refresh() -{ - if(canvas_view_->work_area->grid_status()) - toggle_grid_show.set_active(true); - else - toggle_grid_show.set_active(false); - - if(canvas_view_->work_area->get_grid_snap()) - toggle_grid_snap.set_active(true); - else - toggle_grid_snap.set_active(false); - - vector_grid_size.set_value(canvas_view_->work_area->get_grid_size()); - - tooltips.set_tip(toggle_time_snap,_("Not yet implemented")); - toggle_time_snap.set_sensitive(false); - - update_title(); -} - -void -CanvasOptions::on_grid_snap_toggle() -{ -} - -void -CanvasOptions::on_grid_show_toggle() -{ -} - -void -CanvasOptions::on_apply_pressed() -{ - canvas_view_->set_grid_snap_toggle(toggle_grid_snap.get_active()); - if(toggle_grid_snap.get_active()) - canvas_view_->work_area->enable_grid_snap(); - else - canvas_view_->work_area->disable_grid_snap(); - - canvas_view_->set_grid_show_toggle(toggle_grid_show.get_active()); - if(toggle_grid_show.get_active()) - canvas_view_->work_area->enable_grid(); - else - canvas_view_->work_area->disable_grid(); - - canvas_view_->work_area->set_grid_size(vector_grid_size.get_value()); -} - -void -CanvasOptions::on_ok_pressed() -{ - on_apply_pressed(); - hide(); -} - -void -CanvasOptions::on_cancel_pressed() -{ - refresh(); - hide(); -} diff --git a/synfig-studio/src/gtkmm/canvasoptions.h b/synfig-studio/src/gtkmm/canvasoptions.h deleted file mode 100644 index 452ab3f..0000000 --- a/synfig-studio/src/gtkmm/canvasoptions.h +++ /dev/null @@ -1,82 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasoptions.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_GTKMM_CANVASOPTIONS_H -#define __SYNFIG_GTKMM_CANVASOPTIONS_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include -#include -#include "widget_value.h" -#include "widget_vector.h" - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio -{ - -class CanvasView; - -class CanvasOptions : public Gtk::Dialog -{ - Gtk::Tooltips tooltips; - - etl::loose_handle canvas_view_; - - Gtk::CheckButton toggle_grid_snap; - Gtk::CheckButton toggle_grid_show; - - Widget_Vector vector_grid_size; - - Gtk::CheckButton toggle_time_snap; - -public: - CanvasOptions(etl::loose_handle canvas_view); - ~CanvasOptions(); - - void refresh(); - void update_title(); -private: - - void on_grid_snap_toggle(); - void on_grid_show_toggle(); - - void on_ok_pressed(); - void on_apply_pressed(); - void on_cancel_pressed(); -}; // END of class CanvasOptions - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/canvasproperties.cpp b/synfig-studio/src/gtkmm/canvasproperties.cpp deleted file mode 100644 index d095331..0000000 --- a/synfig-studio/src/gtkmm/canvasproperties.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasproperties.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007, 2008 Chris Moore -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "canvasproperties.h" -#include -#include -#include -#include -#include -#include "metadatatreestore.h" -#include -#include -#include "app.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -CanvasProperties::CanvasProperties(Gtk::Window& parent,etl::handle canvas_interface): - Gtk::Dialog(_("Canvas Properties"),parent,false,true), - canvas_interface_(canvas_interface) -{ - widget_rend_desc.show(); - widget_rend_desc.signal_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::on_rend_desc_changed)); - - Gtk::Alignment *dialogPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - dialogPadding->set_padding(12, 12, 12, 12); - get_vbox()->pack_start(*dialogPadding, false, false, 0); - - Gtk::VBox *dialogBox = manage(new Gtk::VBox(false, 12)); - dialogPadding->add(*dialogBox); - - Gtk::Frame *info_frame=manage(new Gtk::Frame(_("Canvas Info"))); - info_frame->set_shadow_type(Gtk::SHADOW_NONE); - ((Gtk::Label *) info_frame->get_label_widget())->set_markup(_("Canvas Info")); - dialogBox->pack_start(*info_frame, false, false, 0); - - Gtk::Alignment *infoPadding = manage(new Gtk::Alignment(0, 0, 1, 1)); - infoPadding->set_padding(6, 0, 24, 0); - info_frame->add(*infoPadding); - - Gtk::Table *info_table=manage(new Gtk::Table(2,2,false)); - info_table->set_row_spacings(6); - info_table->set_col_spacings(12); - infoPadding->add(*info_table); - - // The root canvas doesn't have an ID, so don't - // display it if this is a root canvas. - if(!canvas_interface_->get_canvas()->is_root()) - { - Gtk::Label *idLabel = manage(new Gtk::Label(_("_ID"), true)); - idLabel->set_alignment(0, 0.5); - idLabel->set_mnemonic_widget(entry_id); - info_table->attach(*idLabel, 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - info_table->attach(entry_id, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - } - Gtk::Label *nameLabel = manage(new Gtk::Label(_("_Name"), true)); - nameLabel->set_alignment(0, 0.5); - nameLabel->set_mnemonic_widget(entry_name); - Gtk::Label *descriptionLabel = manage(new Gtk::Label(_("_Description"), true)); - descriptionLabel->set_alignment(0, 0.5); - descriptionLabel->set_mnemonic_widget(entry_description); - info_table->attach(*nameLabel, 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - info_table->attach(*descriptionLabel, 0, 1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - info_table->attach(entry_name, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - info_table->attach(entry_description, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - dialogBox->pack_start(widget_rend_desc, false, false, 0); - - canvas_interface_->signal_rend_desc_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh)); - canvas_interface_->signal_id_changed().connect(sigc::mem_fun(*this,&studio::CanvasProperties::refresh)); - - Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); - ok_button->show(); - add_action_widget(*ok_button,2); - ok_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_ok_pressed)); - - Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply")))); - apply_button->show(); - add_action_widget(*apply_button,1); - apply_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_apply_pressed)); - - Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close")))); - cancel_button->show(); - add_action_widget(*cancel_button,0); - cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_cancel_pressed)); - - //set_default_response(1); - - get_vbox()->show_all(); - refresh(); - - update_title(); -} - -Gtk::Widget& -CanvasProperties::create_meta_data_view() -{ - MetaDataTreeStore::Model model; - meta_data_tree_view=(manage(new class Gtk::TreeView())); - - meta_data_tree_view->append_column(_("Key"),model.key); - meta_data_tree_view->append_column_editable(_("Data"),model.data); - meta_data_tree_view->set_model(MetaDataTreeStore::create(canvas_interface_)); - meta_data_tree_view->set_rules_hint(); - meta_data_tree_view->show(); - - Gtk::ScrolledWindow *scrolledwindow = manage(new class Gtk::ScrolledWindow()); - scrolledwindow->set_flags(Gtk::CAN_FOCUS); - scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - scrolledwindow->add(*meta_data_tree_view); - scrolledwindow->set_shadow_type(Gtk::SHADOW_ETCHED_IN); - scrolledwindow->show(); - - - - Gtk::Table *table=manage(new Gtk::Table()); - table->attach(*scrolledwindow, 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - - Gtk::Button* button_add(manage(new Gtk::Button(Gtk::StockID("gtk-add")))); - button_add->show(); - button_add->signal_clicked().connect(sigc::mem_fun(*this,&CanvasProperties::on_button_meta_data_add)); - table->attach(*button_add, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - Gtk::Button* button_delete(manage(new Gtk::Button(Gtk::StockID("gtk-delete")))); - button_delete->show(); - button_delete->signal_clicked().connect(sigc::mem_fun(*this,&CanvasProperties::on_button_meta_data_delete)); - table->attach(*button_delete, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - table->show(); - return *table; -} - -void -CanvasProperties::on_button_meta_data_add() -{ - synfig::String key; - if(App::dialog_entry(_("New MetaData Entry"), _("Please enter the name of the key"),key) && !key.empty()) - { - canvas_interface_->set_meta_data(key," "); - } - -} - -void -CanvasProperties::on_button_meta_data_delete() -{ -} - -void -CanvasProperties::update_title() -{ - set_title(_("Properties")+String(" - ")+canvas_interface_->get_canvas()->get_name()); -} - -void -CanvasProperties::refresh() -{ - widget_rend_desc.set_rend_desc(canvas_interface_->get_canvas()->rend_desc()); - entry_id.set_text(canvas_interface_->get_canvas()->get_id()); - entry_name.set_text(canvas_interface_->get_canvas()->get_name()); - entry_description.set_text(canvas_interface_->get_canvas()->get_description()); - - dirty_rend_desc=false; - - update_title(); -} - -CanvasProperties::~CanvasProperties() -{ -} - -void -CanvasProperties::on_rend_desc_changed() -{ - dirty_rend_desc=true; -} - -void -CanvasProperties::on_apply_pressed() -{ - synfigapp::Action::PassiveGrouper group(canvas_interface_->get_instance().get(),_("Edit Canvas Properties")); - - // fetch these three values first, because each set_() method refreshes the dialog with currently set values - String id = entry_id.get_text(); - String name = entry_name.get_text(); - String description = entry_description.get_text(); - - // do this first, because the other three cause the dialog to be refreshed with currently set values - if (dirty_rend_desc) canvas_interface_->set_rend_desc(widget_rend_desc.get_rend_desc()); - - if (id != canvas_interface_->get_canvas()->get_id() && !id.empty()) canvas_interface_->set_id(id); - if (name != canvas_interface_->get_canvas()->get_name()) canvas_interface_->set_name(name); - if (description != canvas_interface_->get_canvas()->get_description()) canvas_interface_->set_description(description); - - dirty_rend_desc=false; -} - -void -CanvasProperties::on_ok_pressed() -{ - on_apply_pressed(); - hide(); -} - -void -CanvasProperties::on_cancel_pressed() -{ - refresh(); - hide(); -} diff --git a/synfig-studio/src/gtkmm/canvasproperties.h b/synfig-studio/src/gtkmm/canvasproperties.h deleted file mode 100644 index 3a32d40..0000000 --- a/synfig-studio/src/gtkmm/canvasproperties.h +++ /dev/null @@ -1,87 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasproperties.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_GTKMM_CANVASPROPERTIES_H -#define __SYNFIG_GTKMM_CANVASPROPERTIES_H - -/* === H E A D E R S ======================================================= */ - -#include - -#include -#include -#include -#include -#include - -#include "renddesc.h" - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace Gtk { class TreeView; }; -namespace synfigapp { class CanvasInterface; }; - -namespace studio -{ -class CanvasProperties : public Gtk::Dialog -{ - Gtk::Tooltips tooltips; - - etl::handle canvas_interface_; - Widget_RendDesc widget_rend_desc; - Gtk::Entry entry_id; - Gtk::Entry entry_name; - Gtk::Entry entry_description; - - bool dirty_rend_desc; - - Gtk::TreeView* meta_data_tree_view; - void on_button_meta_data_add(); - void on_button_meta_data_delete(); - -public: - CanvasProperties(Gtk::Window& parent,etl::handle canvas_interface); - ~CanvasProperties(); - - void refresh(); - void update_title(); -private: - void on_rend_desc_changed(); - - Gtk::Widget& create_meta_data_view(); - - void on_ok_pressed(); - void on_apply_pressed(); - void on_cancel_pressed(); -}; // END of class CanvasProperties - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/canvastreestore.cpp b/synfig-studio/src/gtkmm/canvastreestore.cpp deleted file mode 100644 index f49d7a3..0000000 --- a/synfig-studio/src/gtkmm/canvastreestore.cpp +++ /dev/null @@ -1,622 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvastreestore.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2008 Chris Moore -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "canvastreestore.h" -#include -#include "iconcontroller.h" -#include -#include -#include -#include -#include "cellrenderer_value.h" -#include "cellrenderer_timetrack.h" -#include - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -static CanvasTreeStore::Model& ModelHack() -{ - static CanvasTreeStore::Model* model(0); - if(!model)model=new CanvasTreeStore::Model; - return *model; -} - -CanvasTreeStore::CanvasTreeStore(etl::loose_handle canvas_interface_): - Gtk::TreeStore(ModelHack()), - canvas_interface_ (canvas_interface_) -{ -} - -CanvasTreeStore::~CanvasTreeStore() -{ -} - -void -CanvasTreeStore::get_value_vfunc(const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const -{ - if(column==model.value.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - - Glib::Value x; - g_value_init(x.gobj(),x.value_type()); - - if(!value_desc) - { - x.set(ValueBase()); - } - else - if(value_desc.is_const()) - x.set(value_desc.get_value()); - else - if(value_desc.is_value_node()) - x.set((*value_desc.get_value_node())(canvas_interface()->get_time())); - else - { - synfig::error(__FILE__":%d: Unable to figure out value",__LINE__); - return; - } - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - if(column==model.is_value_node.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - - Glib::Value x; - g_value_init(x.gobj(),x.value_type()); - - x.set(value_desc && value_desc.is_value_node()); - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - if(column==model.is_shared.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - - Glib::Value x; - g_value_init(x.gobj(),x.value_type()); - - x.set(value_desc.is_value_node() && value_desc.get_value_node()->rcount()>1); - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - if(column==model.is_exported.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - - Glib::Value x; - g_value_init(x.gobj(),x.value_type()); - - x.set(value_desc.is_value_node() && value_desc.get_value_node()->is_exported()); - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - if(column==model.is_canvas.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - - Glib::Value x; - g_value_init(x.gobj(),x.value_type()); - - x.set(!value_desc && (Canvas::Handle)(*iter)[model.canvas]); - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - if(column==model.id.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - - Glib::Value x; - g_value_init(x.gobj(),x.value_type()); - - if(value_desc && value_desc.is_value_node()) - x.set(value_desc.get_value_node()->get_id()); - else if(!value_desc && Canvas::Handle((*iter)[model.canvas])) - x.set(Canvas::Handle((*iter)[model.canvas])->get_id()); - else - return Gtk::TreeStore::get_value_vfunc(iter,column,value); - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - if(column==model.is_editable.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - - Glib::Value x; - g_value_init(x.gobj(),x.value_type()); - - x.set(!value_desc.is_value_node() || synfigapp::is_editable(value_desc.get_value_node())); - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - if(column==model.type.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - - Glib::Value x; - g_value_init(x.gobj(),x.value_type()); - - // Set the type - if(!value_desc) - { - if((*iter)[model.is_canvas]) - x.set(_("Canvas")); - } - else - { - if(!value_desc.is_value_node() || value_desc.get_value_node()->get_name()=="constant") - { - x.set(ValueBase::type_local_name(value_desc.get_value_type())); - } - else - { - x.set(value_desc.get_value_node()->get_local_name()); - } - } - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - if(column==model.label.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - - Glib::Value x; - g_value_init(x.gobj(),x.value_type()); - - // Set the type - if(!value_desc) - { - Canvas::Handle canvas((*iter)[model.canvas]); - if(canvas) - { - if(!canvas->get_id().empty()) - x.set(canvas->get_id()); - else - if(!canvas->get_name().empty()) - x.set(canvas->get_name()); - else - x.set(_("[Unnamed]")); - x.set(_("Canvas")); - } - return Gtk::TreeStore::get_value_vfunc(iter,column,value); - } - else - { - ValueNode::Handle value_node=value_desc.get_value_node(); - - // Setup the row's label - if(value_node->get_id().empty()) - x.set(Glib::ustring((*iter)[model.name])); - else if(Glib::ustring((*iter)[model.name]).empty()) - x.set(value_node->get_id()); - else - x.set(Glib::ustring((*iter)[model.name])+" ("+value_node->get_id()+')'); - } - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - if(column==model.icon.index()) - { - synfigapp::ValueDesc value_desc((*iter)[model.value_desc]); - if(!value_desc) - return Gtk::TreeStore::get_value_vfunc(iter,column,value); - - Glib::Value > x; - g_value_init(x.gobj(),x.value_type()); - - x.set(get_tree_pixbuf(value_desc.get_value_type())); - - g_value_init(value.gobj(),x.value_type()); - g_value_copy(x.gobj(),value.gobj()); - } - else - Gtk::TreeStore::get_value_vfunc(iter,column,value); -} - -bool -CanvasTreeStore::find_first_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter) -{ - iter=children().begin(); - while(iter && value_desc!=(*iter)[model.value_desc]) - { - if(!iter->children().empty()) - { - Gtk::TreeIter iter2(iter->children().begin()); - //! \todo confirm that the && should be done before the || - if((iter2 && value_desc==(*iter2)[model.value_desc]) || find_next_value_desc(value_desc, iter2)) - { - iter=iter2; - return true; - } - } - Gtk::TreeIter iter2(++iter); - if(!iter2) - iter==iter->parent(); - else - iter=iter2; - } - return (bool)iter && value_desc==(*iter)[model.value_desc]; -} - -bool -CanvasTreeStore::find_next_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter) -{ - if(!iter) return find_first_value_desc(value_desc,iter); - - if(iter) do { - if(!iter->children().empty()) - { - Gtk::TreeIter iter2(iter->children().begin()); - //! \todo confirm that the && should be done before the || - if((iter2 && value_desc==(*iter2)[model.value_desc]) || find_next_value_desc(value_desc, iter2)) - { - iter=iter2; - return true; - } - } - Gtk::TreeIter iter2(++iter); - if(!iter2) - { - iter==iter->parent(); - if(iter)++iter; - } - else - iter=iter2; - } while(iter && value_desc!=(*iter)[model.value_desc]); - return (bool)iter && value_desc==(*iter)[model.value_desc]; -} - -bool -CanvasTreeStore::find_first_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter) -{ - iter=children().begin(); - while(iter && value_node!=(ValueNode::Handle)(*iter)[model.value_node]) - { - if(!iter->children().empty()) - { - Gtk::TreeIter iter2(iter->children().begin()); - //! \todo confirm that the && should be done before the || - if((iter2 && value_node==(ValueNode::Handle)(*iter2)[model.value_node]) || find_next_value_node(value_node, iter2)) - { - iter=iter2; - return true; - } - } - Gtk::TreeIter iter2(++iter); - if(!iter2) - iter==iter->parent(); - else - iter=iter2; - } - return (bool)iter && value_node==(ValueNode::Handle)(*iter)[model.value_node]; -} - -bool -CanvasTreeStore::find_next_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter) -{ - if(!iter) return find_first_value_node(value_node,iter); - - if(iter) do { - if(!iter->children().empty()) - { - Gtk::TreeIter iter2(iter->children().begin()); - //! \todo confirm that the && should be done before the || - if((iter2 && value_node==(ValueNode::Handle)(*iter2)[model.value_node]) || find_next_value_node(value_node, iter2)) - { - iter=iter2; - return true; - } - } - Gtk::TreeIter iter2(++iter); - if(!iter2) - { - iter==iter->parent(); - if(iter)++iter; - } - else - iter=iter2; - } while(iter && value_node!=(ValueNode::Handle)(*iter)[model.value_node]); - return (bool)iter && value_node==(ValueNode::Handle)(*iter)[model.value_node]; -} - -void -CanvasTreeStore::set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc, bool do_children) -{ - Gtk::TreeModel::Children children = row.children(); - while(!children.empty() && erase(children.begin())) - ; - - row[model.value_desc]=value_desc; - try - { - //row[model.icon] = get_tree_pixbuf(value_desc.get_value_type()); - - if(value_desc.is_value_node()) - { - ValueNode::Handle value_node=value_desc.get_value_node(); - - assert(value_node); - - row[model.value_node] = value_node; - //row[model.is_canvas] = false; - //row[model.is_value_node] = true; - //row[model.is_editable] = synfigapp::is_editable(value_node); - //row[model.id]=value_node->get_id(); - - // Set the canvas - if(value_desc.parent_is_canvas()) - row[model.canvas]=value_desc.get_canvas(); - else - row[model.canvas]=canvas_interface()->get_canvas(); - - LinkableValueNode::Handle linkable; - linkable=LinkableValueNode::Handle::cast_dynamic(value_node); - - if(linkable && do_children) - { - row[model.link_count] = linkable->link_count(); - for(int i=0;ilink_count();i++) - { - Gtk::TreeRow child_row=*(append(row.children())); - child_row[model.link_id] = i; - child_row[model.canvas] = static_cast(row[model.canvas]); - child_row[model.name] = linkable->link_local_name(i); - set_row(child_row,synfigapp::ValueDesc(linkable,i)); - } - } - return; - } - else - { - //row[model.is_value_node] = false; - //row[model.is_editable] = true; - //row[model.label] = Glib::ustring(row[model.name]); - return; - } - } - catch(synfig::Exception::IDNotFound x) - { - synfig::error(__FILE__":%d: IDNotFound thrown",__LINE__); - erase(row); - return; - } - - // We should never get to this point - assert(0); -} - -void -CanvasTreeStore::refresh_row(Gtk::TreeModel::Row &row, bool do_children) -{ - synfigapp::ValueDesc value_desc=row[model.value_desc]; - - if(value_desc) - { - if((bool)row[model.is_value_node] != value_desc.is_value_node() || - (!bool(row[model.is_value_node]) && row[model.link_count]!=0)) - { - set_row(row,value_desc,do_children); - return; - } - - if(row[model.is_value_node]) - { - ValueNode::Handle value_node(value_desc.get_value_node()); - - if(ValueNode::Handle(row[model.value_node])!=value_node) - { - rebuild_row(row,do_children); - return; - } - - //row[model.id]=value_node->get_id(); - - // Setup the row's label - /* - if(value_node->get_id().empty()) - row[model.label] = Glib::ustring(row[model.name]); - else if(Glib::ustring(row[model.name]).empty()) - row[model.label] = value_node->get_id(); - else - row[model.label] = Glib::ustring(row[model.name])+" ("+value_node->get_id()+')'; - */ - - LinkableValueNode::Handle linkable; - linkable=LinkableValueNode::Handle::cast_dynamic(value_node); - if(do_children && linkable && ((int)row[model.link_count] != linkable->link_count())) - { - // Gtk::TreeModel::Children children = row.children(); - // while(!children.empty() && erase(children.begin())); - - set_row(row,value_desc); - return; - } - } - else - { - //row[model.label] = Glib::ustring(row[model.name]); - //row[model.is_value_node] = false; - //row[model.is_editable] = true; - } - } - if(!do_children) - return; - - Gtk::TreeModel::Children children = row.children(); - Gtk::TreeModel::Children::iterator iter; - - if(!children.empty()) - for(iter = children.begin(); iter != children.end(); ++iter) - { - Gtk::TreeRow row=*iter; - refresh_row(row); - } -} - -void -CanvasTreeStore::rebuild_row(Gtk::TreeModel::Row &row, bool do_children) -{ - synfigapp::ValueDesc value_desc=(synfigapp::ValueDesc)row[model.value_desc]; - - if(value_desc && value_desc.get_value_node()) - { - ValueNode::Handle value_node; - value_node=value_desc.get_value_node(); - - assert(value_node);if(!value_node)return; - - if(value_node && value_node!=(ValueNode::Handle)row[model.value_node]) - { -// Gtk::TreeModel::Children children = row.children(); -// while(!children.empty() && erase(children.begin())); - - set_row(row,value_desc,do_children); - return; - } - - LinkableValueNode::Handle linkable; - linkable=LinkableValueNode::Handle::cast_dynamic(value_node); - - if( do_children && linkable && (int)row[model.link_count] != linkable->link_count()) - { -// Gtk::TreeModel::Children children = row.children(); -// while(!children.empty() && erase(children.begin())); - - set_row(row,value_desc); - return; - } - - //if(!value_node) - // value_node=row[model.value_node]; - - row[model.id]=value_node->get_id(); - - // Setup the row's label - if(value_node->get_id().empty()) - row[model.label] = Glib::ustring(row[model.name]); - else if(Glib::ustring(row[model.name]).empty()) - row[model.label] = value_node->get_id(); - else - row[model.label] = Glib::ustring(row[model.name])+" ("+value_node->get_id()+')'; - } - else - { - row[model.label] = Glib::ustring(row[model.name]); - row[model.is_value_node] = false; - row[model.is_editable] = true; - Gtk::TreeModel::Children children = row.children(); - while(!children.empty() && erase(children.begin())) - ; - } - if(!do_children) - return; - - Gtk::TreeModel::Children children = row.children(); - Gtk::TreeModel::Children::iterator iter; - if(!children.empty()) - for(iter = children.begin(); iter != children.end(); ++iter) - { - Gtk::TreeRow row=*iter; - rebuild_row(row); - } -} - -CellRenderer_ValueBase* -CanvasTreeStore::add_cell_renderer_value(Gtk::TreeView::Column* column) -{ - const CanvasTreeStore::Model model; - - CellRenderer_ValueBase* ret; - - ret=Gtk::manage( new CellRenderer_ValueBase() ); - - column->pack_start(*ret,true); - column->add_attribute(ret->property_value(), model.value); - column->add_attribute(ret->property_editable(), model.is_editable); - column->add_attribute(ret->property_canvas(), model.canvas); - - return ret; -} - -CellRenderer_TimeTrack* -CanvasTreeStore::add_cell_renderer_value_node(Gtk::TreeView::Column* column) -{ - const CanvasTreeStore::Model model; - - CellRenderer_TimeTrack* ret; - - ret = Gtk::manage( new CellRenderer_TimeTrack() ); - - column->pack_start(*ret,true); - //column->add_attribute(ret->property_visible(), model.is_value_node); - column->add_attribute(ret->property_value_desc(), model.value_desc); - column->add_attribute(ret->property_canvas(), model.canvas); - - - return ret; -} diff --git a/synfig-studio/src/gtkmm/canvastreestore.h b/synfig-studio/src/gtkmm/canvastreestore.h deleted file mode 100644 index faed8b6..0000000 --- a/synfig-studio/src/gtkmm/canvastreestore.h +++ /dev/null @@ -1,195 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvastreestore.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_STUDIO_CANVASTREESTORE_H -#define __SYNFIG_STUDIO_CANVASTREESTORE_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace studio { - -class CellRenderer_TimeTrack; -class CellRenderer_ValueBase; - - enum ColumnID - { - COLUMNID_ID, - COLUMNID_VALUE, - COLUMNID_TIME_TRACK, - COLUMNID_TYPE, - - COLUMNID_END //!< \internal - }; -#define COLUMNID_NAME COLUMNID_ID - -class CanvasTreeStore : virtual public Gtk::TreeStore -{ - /* - -- ** -- P U B L I C T Y P E S --------------------------------------------- - */ - -public: - - class Model : public Gtk::TreeModel::ColumnRecord - { - public: - Gtk::TreeModelColumn > icon; - Gtk::TreeModelColumn label; - Gtk::TreeModelColumn name; - Gtk::TreeModelColumn id; - - Gtk::TreeModelColumn canvas; - Gtk::TreeModelColumn is_canvas; - - Gtk::TreeModelColumn value_node; - Gtk::TreeModelColumn is_value_node; - Gtk::TreeModelColumn value; - Gtk::TreeModelColumn type; - Gtk::TreeModelColumn link_id; - Gtk::TreeModelColumn link_count; - - Gtk::TreeModelColumn is_editable; - - Gtk::TreeModelColumn is_shared; - Gtk::TreeModelColumn is_exported; - - Gtk::TreeModelColumn value_desc; - - Gtk::TreeModelColumn tooltip; - - Model() - { - add(value); - add(name); - add(label); - add(icon); - add(type); - add(id); - add(canvas); - add(value_node); - add(is_canvas); - add(is_value_node); - - add(is_shared); - add(is_exported); - add(is_editable); - add(value_desc); - add(link_count); - add(link_id); - - add(tooltip); - } - }; - - /* - -- ** -- P U B L I C D A T A ------------------------------------------------ - */ - -public: - - const Model model; - - //std::multimap, sigc::connection> connection_map; - - /* - -- ** -- P R I V A T E D A T A --------------------------------------------- - */ - -private: - - etl::loose_handle canvas_interface_; - - /* - -- ** -- P R I V A T E M E T H O D S --------------------------------------- - */ - -private: - -protected: - virtual void get_value_vfunc (const Gtk::TreeModel::iterator& iter, int column, Glib::ValueBase& value)const; - - /* - -- ** -- S I G N A L T E R M I N A L S ------------------------------------- - */ - -private: - - /* - -- ** -- P U B L I C M E T H O D S ----------------------------------------- - */ - -public: - - CanvasTreeStore(etl::loose_handle canvas_interface_); - ~CanvasTreeStore(); - - etl::loose_handle canvas_interface() { return canvas_interface_; } - etl::loose_handle canvas_interface()const { return canvas_interface_; } - - virtual void rebuild_row(Gtk::TreeModel::Row &row, bool do_children=true); - - virtual void refresh_row(Gtk::TreeModel::Row &row, bool do_children=true); - - virtual void set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc, bool do_children=true); - - bool find_first_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter); - bool find_next_value_desc(const synfigapp::ValueDesc& value_desc, Gtk::TreeIter& iter); - - bool find_first_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter); - bool find_next_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter); - - - static CellRenderer_ValueBase* add_cell_renderer_value(Gtk::TreeView::Column* column); - - static CellRenderer_TimeTrack* add_cell_renderer_value_node(Gtk::TreeView::Column* column); - - etl::loose_handle get_canvas_interface()const { return canvas_interface_; } - - virtual void on_value_node_changed(synfig::ValueNode::Handle value_node)=0; - - /* - -- ** -- P R O T E C T E D M E T H O D S ----------------------------------- - */ - -public: - -}; // END of class CanvasTreeStore - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/canvasview.cpp b/synfig-studio/src/gtkmm/canvasview.cpp deleted file mode 100644 index f520ced..0000000 --- a/synfig-studio/src/gtkmm/canvasview.cpp +++ /dev/null @@ -1,4338 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasview.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007, 2008 Chris Moore -** Copyright (c) 2009 Carlos López -** Copyright (c) 2009 Nikita Kitaev -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -//#include -//#include - -#include -#include -//#include - -#include "canvasview.h" -#include "instance.h" -#include "app.h" -#include "cellrenderer_value.h" -#include "cellrenderer_timetrack.h" -#include "workarea.h" -#include "dialog_color.h" -#include "eventkey.h" - -#include "state_polygon.h" -#include "state_bline.h" -#include "state_normal.h" -#include "state_eyedrop.h" -#include "state_draw.h" - -#include "ducktransform_scale.h" -#include "ducktransform_translate.h" -#include "ducktransform_rotate.h" - -#include "event_mouse.h" -#include "event_layerclick.h" - -#include "toolbox.h" - -#include "dialog_preview.h" -#include "dialog_soundselect.h" - -#include "preview.h" -#include "audiocontainer.h" -#include "widget_timeslider.h" -#include "keyframedial.h" - -#include -#include - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; -using namespace studio; -using namespace sigc; - -/* === M A C R O S ========================================================= */ - -#define GRAB_HINT_DATA(y) { \ - String x; \ - if(synfigapp::Main::settings().get_value(String("pref.")+y+"_hints",x)) \ - { \ - set_type_hint((Gdk::WindowTypeHint)atoi(x.c_str())); \ - } \ - } - -#define DEFAULT_TIME_WINDOW_SIZE (10.0) - -#ifndef SMALL_BUTTON -#define SMALL_BUTTON(button,stockid,tooltip) \ - button = manage(new class Gtk::Button()); \ - icon=manage(new Gtk::Image(Gtk::StockID(stockid),iconsize)); \ - button->add(*icon); \ - tooltips.set_tip(*button,tooltip); \ - icon->set_padding(0,0);\ - icon->show(); \ - button->set_relief(Gtk::RELIEF_NONE); \ - button->show() -#endif - -#ifndef NORMAL_BUTTON -#define NORMAL_BUTTON(button,stockid,tooltip) \ - button = manage(new class Gtk::Button()); \ - icon=manage(new Gtk::Image(Gtk::StockID(stockid),Gtk::ICON_SIZE_BUTTON)); \ - button->add(*icon); \ - tooltips.set_tip(*button,tooltip); \ - icon->set_padding(0,0);\ - icon->show(); \ - /*button->set_relief(Gtk::RELIEF_NONE);*/ \ - button->show() -#endif - -#define NEW_SMALL_BUTTON(x,y,z) Gtk::Button *SMALL_BUTTON(x,y,z) - -#define NOT_IMPLEMENTED_SLOT sigc::mem_fun(*reinterpret_cast(get_ui_interface().get()),&studio::CanvasViewUIInterface::not_implemented) - -#define SLOT_EVENT(x) sigc::hide_return(sigc::bind(sigc::mem_fun(*this,&studio::CanvasView::process_event_key),x)) - -/* === C L A S S E S ======================================================= */ - -class studio::UniversalScrubber -{ - CanvasView *canvas_view; - - bool scrubbing; - etl::clock scrub_timer; - - sigc::connection end_scrub_connection; -public: - UniversalScrubber(CanvasView *canvas_view): - canvas_view(canvas_view), - scrubbing(false) - { - canvas_view->canvas_interface()->signal_time_changed().connect( - sigc::mem_fun(*this,&studio::UniversalScrubber::on_time_changed) - ); - } - - ~UniversalScrubber() - { - end_scrub_connection.disconnect(); - } - - void on_time_changed() - { - // Make sure we are changing the time quickly - // before we enable scrubbing - if(!scrubbing && scrub_timer()>1) - { - scrub_timer.reset(); - return; - } - - // If we aren't scrubbing already, enable it - if(!scrubbing) - { - scrubbing=true; - audio_container()->start_scrubbing(canvas_view->get_time()); - } - - // Reset the scrubber ender - end_scrub_connection.disconnect(); - end_scrub_connection=Glib::signal_timeout().connect( - sigc::bind_return( - sigc::mem_fun(*this,&UniversalScrubber::end_of_scrubbing), - false - ), - 1000 - ); - - // Scrub! - audio_container()->scrub(canvas_view->get_time()); - - scrub_timer.reset(); - } - - void end_of_scrubbing() - { - scrubbing=false; - audio_container()->stop_scrubbing(); - scrub_timer.reset(); - } - - handle audio_container() - { - assert(canvas_view->audio); - return canvas_view->audio; - } -}; - -class studio::CanvasViewUIInterface : public synfigapp::UIInterface -{ - CanvasView *view; - -public: - - CanvasViewUIInterface(CanvasView *view): - view(view) - { - view->statusbar->push(_("Idle")); - } - - ~CanvasViewUIInterface() - { - //view->statusbar->pop(); - //view->progressbar->set_fraction(0); - } - - virtual Response confirmation(const std::string &title, - const std::string &primaryText, - const std::string &secondaryText, - const std::string &confirmPhrase, - const std::string &cancelPhrase, - Response defaultResponse=RESPONSE_OK) - { - view->present(); - //while(studio::App::events_pending())studio::App::iteration(false); - Gtk::MessageDialog dialog( - *view, // Parent - primaryText, // Message - false, // Markup - Gtk::MESSAGE_WARNING, // Type - Gtk::BUTTONS_NONE, // Buttons - true // Modal - ); - - if (! title.empty()) - dialog.set_title(title); - if (! secondaryText.empty()) - dialog.set_secondary_text(secondaryText); - - dialog.add_button(cancelPhrase, RESPONSE_CANCEL); - dialog.add_button(confirmPhrase, RESPONSE_OK); - dialog.set_default_response(defaultResponse); - - dialog.show_all(); - return (Response) dialog.run(); - } - - virtual Response yes_no(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES) - { - view->present(); - //while(studio::App::events_pending())studio::App::iteration(false); - Gtk::Dialog dialog( - title, // Title - *view, // Parent - true, // Modal - true // use_separator - ); - Gtk::Label label(message); - label.show(); - - dialog.get_vbox()->pack_start(label); - dialog.add_button(Gtk::StockID("gtk-yes"),RESPONSE_YES); - dialog.add_button(Gtk::StockID("gtk-no"),RESPONSE_NO); - - dialog.set_default_response(dflt); - dialog.show(); - return (Response)dialog.run(); - } - virtual Response yes_no_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES) - { - view->present(); - //while(studio::App::events_pending())studio::App::iteration(false); - Gtk::Dialog dialog( - title, // Title - *view, // Parent - true, // Modal - true // use_separator - ); - Gtk::Label label(message); - label.show(); - - dialog.get_vbox()->pack_start(label); - dialog.add_button(Gtk::StockID("gtk-yes"),RESPONSE_YES); - dialog.add_button(Gtk::StockID("gtk-no"),RESPONSE_NO); - dialog.add_button(Gtk::StockID("gtk-cancel"),RESPONSE_CANCEL); - - dialog.set_default_response(dflt); - dialog.show(); - return (Response)dialog.run(); - } - virtual Response ok_cancel(const std::string &title, const std::string &message,Response dflt=RESPONSE_OK) - { - view->present(); - //while(studio::App::events_pending())studio::App::iteration(false); - Gtk::Dialog dialog( - title, // Title - *view, // Parent - true, // Modal - true // use_separator - ); - Gtk::Label label(message); - label.show(); - - dialog.get_vbox()->pack_start(label); - dialog.add_button(Gtk::StockID("gtk-ok"),RESPONSE_OK); - dialog.add_button(Gtk::StockID("gtk-cancel"),RESPONSE_CANCEL); - - dialog.set_default_response(dflt); - dialog.show(); - return (Response)dialog.run(); - } - - virtual bool - task(const std::string &task) - { - if(!view->is_playing_) - { - view->statusbar->pop(); - view->statusbar->push(task); - } - //while(studio::App::events_pending())studio::App::iteration(false); - if(view->cancel){return false;} - return true; - } - - virtual bool - error(const std::string &err) - { - view->statusbar->push(_("ERROR")); - - // If we are in the process of canceling, - // then just go ahead and return false -- - // don't bother displaying a dialog - if(view->cancel)return false; - Gtk::MessageDialog dialog(*view, err, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true); - dialog.show(); - dialog.run(); - view->statusbar->pop(); - return true; - } - - virtual bool - warning(const std::string &err) - { - view->statusbar->pop(); - view->statusbar->push(err); - - //while(studio::App::events_pending())studio::App::iteration(false); - if(view->cancel)return false; - return true; - } - - virtual bool - amount_complete(int current, int total) - { - if(!view->is_playing_) - { - if(!view->working_depth) - { - if(current) - view->stopbutton->set_sensitive(true); - else - view->stopbutton->set_sensitive(false); - } - float x((float)current/(float)total); - if(x<0)x=0; - else if(x>1)x=1; - view->progressbar->set_fraction(x); - } - //while(studio::App::events_pending())studio::App::iteration(false); - if(view->cancel){/*view->cancel=false;*/return false;} - return true; - } - - void - not_implemented() - { - error(_("Feature not yet implemented")); - } -}; - -class studio::CanvasViewSelectionManager : public synfigapp::SelectionManager -{ - CanvasView *view; - CanvasView::LayerTreeModel layer_tree_model; - CanvasView::ChildrenTreeModel children_tree_model; - -public: - CanvasViewSelectionManager(CanvasView *view): view(view) { } - -private: - void _set_selected_layer(const synfig::Layer::Handle &layer) - { - view->layer_tree->select_layer(layer); -/* - // Don't change the selection while we are busy - // I cannot remember exactly why I put this here... - // It musta been for some reason, but I cannot recall. - //if(App::Busy::count) - // return; - - if(view->layer_tree->get_selection()->get_selected()) - { - const Gtk::TreeRow row = *(view->layer_tree->get_selection()->get_selected()); - - // Don't do anything if that layer is already selected - if(layer == static_cast(row[layer_tree_model.layer])) - return; - } - Gtk::TreeModel::Children::iterator iter; - if(view->layer_tree_store()->find_layer_row(layer,iter)) - { - Gtk::TreePath path(iter); - for(int i=path.get_depth();i;i--) - { - int j; - path=Gtk::TreePath(iter); - for(j=i;j;j--) - path.up(); - view->layer_tree->get_tree_view().expand_row(path,false); - } - view->layer_tree->get_tree_view().scroll_to_row(Gtk::TreePath(iter)); - view->layer_tree->get_selection()->select(iter); - } -*/ - } -public: - - //! Returns the number of layers selected. - virtual int get_selected_layer_count()const - { - return get_selected_layers().size(); - } - - //! Returns a list of the currently selected layers. - virtual LayerList get_selected_layers()const - { -// assert(view->layer_tree); - - if(!view->layer_tree) { synfig::error("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); return LayerList(); } - return view->layer_tree->get_selected_layers(); - } - - //! Returns the first layer selected or an empty handle if none are selected. - virtual synfig::Layer::Handle get_selected_layer()const - { -// assert(view->layer_tree); - - if(!view->layer_tree) { synfig::error("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); return 0; } - return view->layer_tree->get_selected_layer(); - } - - //! Sets which layers should be selected - virtual void set_selected_layers(const LayerList &layer_list) - { -// assert(view->layer_tree); - - if(!view->layer_tree) { synfig::error("%s:%d canvas_view.layer_tree not defined!?", __FILE__, __LINE__); return; } - view->layer_tree->select_layers(layer_list); - //view->get_smach().process_event(EVENT_REFRESH_DUCKS); - - //view->queue_rebuild_ducks(); - } - - //! Sets which layer should be selected. - virtual void set_selected_layer(const synfig::Layer::Handle &layer) - { -// assert(view->layer_tree); - - if(!view->layer_tree) { synfig::error("canvas_view.layer_tree not defined!?"); return; } - view->layer_tree->select_layer(layer); - //view->queue_rebuild_ducks(); - } - - //! Clears the layer selection list - virtual void clear_selected_layers() - { - if(!view->layer_tree) return; - view->layer_tree->clear_selected_layers(); - } - - //! Returns the number of value_nodes selected. - virtual int get_selected_children_count()const - { - return get_selected_children().size(); - } - - static inline void __child_grabber(const Gtk::TreeModel::iterator& iter, ChildrenList* ret) - { - const CanvasView::ChildrenTreeModel children_tree_model; - synfigapp::ValueDesc value_desc((*iter)[children_tree_model.value_desc]); - if(value_desc) - ret->push_back(value_desc); - } - - //! Returns a list of the currently selected value_nodes. - virtual ChildrenList get_selected_children()const - { - if(!view->children_tree) return ChildrenList(); - - Glib::RefPtr selection=view->children_tree->get_selection(); - - if(!selection) - return ChildrenList(); - - ChildrenList ret; - - selection->selected_foreach_iter( - sigc::bind( - sigc::ptr_fun( - &studio::CanvasViewSelectionManager::__child_grabber - ), - &ret - ) - ); - - /* - Gtk::TreeModel::Children::iterator iter(view->children_tree_store()->children().begin()); - iter++; - Gtk::TreeModel::Children children = iter->children(); - for(iter = children.begin(); iter != children.end(); ++iter) - { - Gtk::TreeModel::Row row = *iter; - if(selection->is_selected(row)) - ret.push_back((synfigapp::ValueDesc)row[children_tree_model.value_desc]); - } - */ - return ret; - } - - //! Returns the first value_node selected or an empty handle if none are selected. - virtual ChildrenList::value_type get_selected_child()const - { - if(!view->children_tree) return ChildrenList::value_type(); - - ChildrenList children(get_selected_children()); - - if(children.empty()) - return ChildrenList::value_type(); - - return children.front(); - } - - //! Sets which value_nodes should be selected - virtual void set_selected_children(const ChildrenList &/*children_list*/) - { - return; - } - - //! Sets which value_node should be selected. Empty handle if none. - virtual void set_selected_child(const ChildrenList::value_type &/*child*/) - { - return; - } - - //! Clears the value_node selection list - virtual void clear_selected_children() - { - return; - } - - int get_selected_layer_parameter_count()const - { - return get_selected_layer_parameters().size(); - } - - LayerParamList get_selected_layer_parameters()const - { - if(!view->layer_tree) return LayerParamList(); - - Glib::RefPtr selection=view->layer_tree->get_selection(); - - if(!selection) - return LayerParamList(); - - LayerParamList ret; - - Gtk::TreeModel::Children children = const_cast(view)->layer_tree_store()->children(); - Gtk::TreeModel::Children::iterator iter; - for(iter = children.begin(); iter != children.end(); ++iter) - { - Gtk::TreeModel::Row row = *iter; - Gtk::TreeModel::Children::iterator iter; - for(iter=row.children().begin();iter!=row.children().end();iter++) - { - Gtk::TreeModel::Row row = *iter; - if(selection->is_selected(row)) - ret.push_back(LayerParam(row[layer_tree_model.layer],(Glib::ustring)row[layer_tree_model.id])); - } - } - return ret; - } - - LayerParam get_selected_layer_parameter() const - { - if(!view->layer_tree) return LayerParam(); - return get_selected_layer_parameters().front(); - } - - void set_selected_layer_parameters(const LayerParamList &/*layer_param_list*/) - { - return; - } - - void set_selected_layer_param(const LayerParam &/*layer_param*/) - { - return; - } - - void clear_selected_layer_parameters() - { - return; - } - -}; // END of class SelectionManager - -CanvasView::IsWorking::IsWorking(CanvasView &canvas_view_): - canvas_view_(canvas_view_) -{ - if(!canvas_view_.working_depth) - canvas_view_.stopbutton->set_sensitive(true); - canvas_view_.working_depth++; - canvas_view_.cancel=false; -} - -CanvasView::IsWorking::~IsWorking() -{ - canvas_view_.working_depth--; - if(!canvas_view_.working_depth) - canvas_view_.stopbutton->set_sensitive(false); -} - -CanvasView::IsWorking::operator bool()const -{ - if(canvas_view_.cancel) - return false; - return true; -} - -/* === M E T H O D S ======================================================= */ - -CanvasView::CanvasView(etl::loose_handle instance,etl::handle canvas_interface_): - smach_ (this), - instance_ (instance), - canvas_interface_ (canvas_interface_), - //layer_tree_store_ (LayerTreeStore::create(canvas_interface_)), - //children_tree_store_ (ChildrenTreeStore::create(canvas_interface_)), - //keyframe_tree_store_ (KeyframeTreeStore::create(canvas_interface_)), - time_adjustment_ (0,0,25,0,0,0), - time_window_adjustment_ (0,0,25,0,0,0), - statusbar (manage(new class Gtk::Statusbar())), - quality_adjustment_ (8,1,10,1,1,0), - future_onion_adjustment_ (0,0,2,1,1,0), - past_onion_adjustment_ (0,0,2,1,1,0), - - timeslider (new Widget_Timeslider), - widget_kf_list (new Widget_Keyframe_List), - - ui_interface_ (new CanvasViewUIInterface(this)), - selection_manager_ (new CanvasViewSelectionManager(this)), - is_playing_ (false), - - working_depth (0), - cancel (false), - - canvas_properties (*this,canvas_interface_), - canvas_options (this), - render_settings (*this,canvas_interface_), - waypoint_dialog (*this,canvas_interface_->get_canvas()), - keyframe_dialog (*this,canvas_interface_), - preview_dialog (new Dialog_Preview), - sound_dialog (new Dialog_SoundSelect(*this,canvas_interface_)) -{ - layer_tree=0; - children_tree=0; - duck_refresh_flag=true; - toggling_ducks_=false; - changing_resolution_=false; - updating_quality_=false; - toggling_show_grid=false; - toggling_snap_grid=false; - toggling_onion_skin=false; - - disp_audio = new Widget_Sound(); - - //synfig::info("Canvasview: Entered constructor"); - // Minor hack - get_canvas()->set_time(0); - //layer_tree_store_->rebuild(); - - // Set up the UI and Selection managers - canvas_interface()->set_ui_interface(get_ui_interface()); - canvas_interface()->set_selection_manager(get_selection_manager()); - rebuild_ducks_queued=false; - - //notebook=manage(new class Gtk::Notebook()); - //Gtk::VPaned *vpaned = manage(new class Gtk::VPaned()); - //vpaned->pack1(*create_work_area(), Gtk::EXPAND|Gtk::SHRINK); - //vpaned->pack2(*notebook, Gtk::SHRINK); - //vpaned->show_all(); - - //notebook->show(); - - //notebook->append_page(*create_layer_tree(),_("Layers")); - //notebook->append_page(*create_children_tree(),_("Children")); - //notebook->append_page(*create_keyframe_tree(),_("Keyframes")); - - //synfig::info("Canvasview: Before big chunk of allocation and tabling stuff"); - //create all allocated stuff for this canvas - audio = new AudioContainer(); - - Gtk::Table *layout_table= manage(new class Gtk::Table(1, 4, false)); - //layout_table->attach(*vpaned, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - layout_table->attach(*create_work_area(), 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - layout_table->attach(*create_display_bar(), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - init_menus(); - //layout_table->attach(*App::ui_manager()->get_widget("/menu-main"), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - layout_table->attach(*create_time_bar(), 0, 1, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - layout_table->attach(*create_status_bar(), 0, 1, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - - update_title(); - - layout_table->show(); - add(*layout_table); - - //set_transient_for(*App::toolbox); - - smach_.set_default_state(&state_normal); - - //synfig::info("Canvasview: Before Signals"); - /* - -- ** -- Signals ------------------------------------------------------------- - */ - - canvas_interface()->signal_dirty_preview().connect(sigc::mem_fun(*this,&studio::CanvasView::on_dirty_preview)); - canvas_interface()->signal_mode_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::on_mode_changed)); - - canvas_interface()->signal_time_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::on_time_changed)); - - //canvas_interface()->signal_time_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::refresh_tables)); - canvas_interface()->signal_id_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::on_id_changed)); - canvas_interface()->signal_rend_desc_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::refresh_rend_desc)); - waypoint_dialog.signal_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::on_waypoint_changed)); - waypoint_dialog.signal_delete().connect(sigc::mem_fun(*this,&studio::CanvasView::on_waypoint_delete)); - - //MODIFIED TIME ADJUSTMENT STUFF.... - time_window_adjustment().set_child_adjustment(&time_adjustment()); - time_window_adjustment().signal_value_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::refresh_time_window)); - time_adjustment().signal_value_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::time_was_changed)); - - work_area->signal_layer_selected().connect(sigc::mem_fun(*this,&studio::CanvasView::workarea_layer_selected)); - work_area->signal_input_device_changed().connect(sigc::mem_fun(*this,&studio::CanvasView::on_input_device_changed)); - - canvas_interface()->signal_canvas_added().connect( - sigc::hide( - sigc::mem_fun(*instance,&studio::Instance::refresh_canvas_tree) - ) - ); - canvas_interface()->signal_canvas_removed().connect( - sigc::hide( - sigc::mem_fun(*instance,&studio::Instance::refresh_canvas_tree) - ) - ); - - canvas_interface()->signal_layer_param_changed().connect( - sigc::hide( - sigc::hide( - SLOT_EVENT(EVENT_REFRESH_DUCKS) - ) - ) - ); - - //MUCH TIME STUFF TAKES PLACE IN HERE - refresh_rend_desc(); - refresh_time_window(); - - /*! \todo We shouldn't need to do this at construction -- - ** This should be performed at the first time the window - ** becomes visible. - */ - work_area->queue_render_preview(); - - // If the canvas is really big, zoom out so that we can fit it all in the window - /*! \todo In other words, this is a zoom-to-fit, and should be - ** in its own function. - */ - int w=get_canvas()->rend_desc().get_w()+70; - int h=get_canvas()->rend_desc().get_h()+70; - while(w>700 || h>600) - { - // Minor hack: - // zoom_out() => - // WorkArea::async_update_preview() => - // WorkArea::set_zoom(float) => - // WorkArea::async_update_preview() => - // desc.set_time(cur_time), where cur_time isn't initialized - work_area->set_time(0); - work_area->zoom_out(); - w=round_to_int(get_canvas()->rend_desc().get_w()*work_area->get_zoom()+70); - h=round_to_int(get_canvas()->rend_desc().get_h()*work_area->get_zoom()+70); - } - if(w>700)w=700; - if(h>600)h=600; - set_default_size(w,h); - property_window_position().set_value(Gtk::WIN_POS_NONE); - - std::list listTargets; - listTargets.push_back( Gtk::TargetEntry("STRING") ); - listTargets.push_back( Gtk::TargetEntry("text/plain") ); - listTargets.push_back( Gtk::TargetEntry("image") ); - - drag_dest_set(listTargets); - signal_drag_data_received().connect( sigc::mem_fun(*this, &studio::CanvasView::on_drop_drag_data_received) ); - - /* - Time length(get_canvas()->rend_desc().get_time_end()-get_canvas()->rend_desc().get_time_start()); - if(length<10.0) - { - time_window_adjustment().set_page_increment(length); - time_window_adjustment().set_page_size(length); - } - else - { - time_window_adjustment().set_page_increment(10.0); - time_window_adjustment().set_page_size(10.0); - } - */ - - //synfig::info("Canvasview: Before Sound Hookup"); - //load sound info from meta data - { - //synfig::warning("Should load Audio: %s with %s offset",apath.c_str(),aoffset.c_str()); - - on_audio_file_notify(); //redundant setting of the metadata, but oh well, it's no big deal :) - on_audio_offset_notify(); - - //signal connection - since they are all associated with the canvas view - - //hook in signals for sound options box - sound_dialog->signal_file_changed().connect(sigc::mem_fun(*this,&CanvasView::on_audio_file_change)); - sound_dialog->signal_offset_changed().connect(sigc::mem_fun(*this,&CanvasView::on_audio_offset_change)); - - //attach to the preview when it's visible - //preview_dialog->get_widget().signal_play().connect(sigc::mem_fun(*this,&CanvasView::play_audio)); - //preview_dialog->get_widget().signal_stop().connect(sigc::mem_fun(*this,&CanvasView::stop_audio)); - - //hook to metadata signals - get_canvas()->signal_meta_data_changed("audiofile").connect(sigc::mem_fun(*this,&CanvasView::on_audio_file_notify)); - get_canvas()->signal_meta_data_changed("audiooffset").connect(sigc::mem_fun(*this,&CanvasView::on_audio_offset_notify)); - - //universal_scrubber=std::auto_ptr(new UniversalScrubber(this)); - } - - //synfig::info("Canvasview: Before Final time set up"); - //MORE TIME STUFF - time_window_adjustment().set_value(get_canvas()->rend_desc().get_time_start()); - time_window_adjustment().value_changed(); - - GRAB_HINT_DATA("canvas_view"); - /* - { - set_skip_taskbar_hint(true); - set_skip_pager_hint(true); - set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY); - } - */ - - refresh_rend_desc(); - hide_tables(); - - on_time_changed(); - //synfig::info("Canvasview: Constructor Done"); -} - -CanvasView::~CanvasView() -{ - signal_deleted()(); - - App::ui_manager()->remove_action_group(action_group); - - // Shut down the smach - smach_.egress(); - smach_.set_default_state(0); - - // We want to ensure that the UI_Manager and - // the selection manager get destructed right now. - ui_interface_.reset(); - selection_manager_.reset(); - - // Delete any external widgets - for(;!ext_widget_book_.empty();ext_widget_book_.erase(ext_widget_book_.begin())) - { - if(ext_widget_book_.begin()->second) - delete ext_widget_book_.begin()->second; - } - - //delete preview - audio.reset(); - - hide(); - - // don't be calling on_dirty_preview once this object has been deleted; - // this was causing a crash before - canvas_interface()->signal_dirty_preview().clear(); - - if (getenv("SYNFIG_DEBUG_DESTRUCTORS")) - synfig::info("CanvasView::~CanvasView(): Deleted"); -} - -std::list& -CanvasView::get_pixel_sizes() -{ - // prime factors of 120 are 2, 2, 2, 3, 5 - see TILE_SIZE in synfig-core/trunk/src/synfig/target_tile.h - static int pixel_size_array[] = {2,3,4,5,6,8,10,12,15,20,24,30,40,60,120}; - static list pixel_sizes = list(pixel_size_array, pixel_size_array + sizeof(pixel_size_array) / sizeof(int)); - - return pixel_sizes; -} - -Gtk::Widget * -CanvasView::create_time_bar() -{ - Gtk::Image *icon; - - //Setup the Time Slider and the Time window scroll - Gtk::HScrollbar *time_window_scroll = manage(new class Gtk::HScrollbar(time_window_adjustment())); - //Gtk::HScrollbar *time_scroll = manage(new class Gtk::HScrollbar(time_adjustment())); - //TIME BAR TEMPORARY POSITION - //Widget_Timeslider *time_scroll = manage(new Widget_Timeslider); - timeslider->set_time_adjustment(&time_adjustment()); - timeslider->set_bounds_adjustment(&time_window_adjustment()); - //layout_table->attach(*timeslider, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL); - //Setup the keyframe list widget - widget_kf_list->set_time_adjustment(&time_adjustment()); - widget_kf_list->set_canvas_interface(canvas_interface()); - widget_kf_list->show(); - - tooltips.set_tip(*time_window_scroll,_("Moves the time window")); - tooltips.set_tip(*timeslider,_("Changes the current time")); - time_window_scroll->show(); - timeslider->show(); - //time_window_scroll->set_flags(Gtk::CAN_FOCUS); // Uncomment this produce bad render of the HScroll - timeslider->set_flags(Gtk::CAN_FOCUS); - - //time_scroll->signal_value_changed().connect(sigc::mem_fun(*work_area, &studio::WorkArea::render_preview_hook)); - //time_scroll->set_update_policy(Gtk::UPDATE_DISCONTINUOUS); - - //Setup the Animation Mode Button and the Keyframe Lock button - Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon"); - SMALL_BUTTON(animatebutton,"gtk-yes",_("Animate")); - animatebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_animate_button_pressed)); - animatebutton->show(); - - //Setup the audio display - disp_audio->set_size_request(-1,32); //disp_audio->show(); - disp_audio->set_time_adjustment(&time_adjustment()); - disp_audio->signal_start_scrubbing().connect( - sigc::mem_fun(*audio,&AudioContainer::start_scrubbing) - ); - disp_audio->signal_scrub().connect( - sigc::mem_fun(*audio,&AudioContainer::scrub) - ); - disp_audio->signal_stop_scrubbing().connect( - sigc::mem_fun(*audio,&AudioContainer::stop_scrubbing) - ); - //Setup the current time widget - current_time_widget=manage(new Widget_Time); - current_time_widget->set_value(get_time()); - current_time_widget->set_fps(get_canvas()->rend_desc().get_frame_rate()); - current_time_widget->signal_value_changed().connect( - sigc::mem_fun(*this,&CanvasView::on_current_time_widget_changed) - ); - current_time_widget->set_size_request(0,-1); // request horizontal shrink - tooltips.set_tip(*current_time_widget,_("Current time")); - current_time_widget->show(); - - //Setup the FrameDial widget - framedial = manage(new class FrameDial()); - framedial->signal_seek_begin().connect( - sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time), Time::begin()) - ); - framedial->signal_seek_prev_frame().connect( - sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame), -1) - ); - framedial->signal_play_stop().connect( - sigc::mem_fun(*this, &studio::CanvasView::on_play_stop_pressed) - ); - framedial->signal_seek_next_frame().connect( - sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame), 1) - ); - framedial->signal_seek_end().connect( - sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time), Time::end()) - ); - framedial->show(); - - //Setup the KeyFrameDial widget - KeyFrameDial *keyframedial = Gtk::manage(new class KeyFrameDial()); - keyframedial->signal_seek_prev_keyframe().connect(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe)); - keyframedial->signal_seek_next_keyframe().connect(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe)); - keyframedial->signal_lock_keyframe().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_button_pressed)); - keyframedial->show(); - keyframebutton=keyframedial->get_lock_button(); - - timebar = Gtk::manage(new class Gtk::Table(5, 4, false)); - - //Adjust both widgets to be the same as the - int header_height = 0; - if(getenv("SYNFIG_TIMETRACK_HEADER_HEIGHT")) - header_height = atoi(getenv("SYNFIG_TIMETRACK_HEADER_HEIGHT")); - if (header_height < 3) - header_height = 24; - timeslider->set_size_request(-1,header_height-header_height/3+1); - widget_kf_list->set_size_request(-1,header_height/3+1); - - //Attach widgets to the timebar - //timebar->attach(*manage(disp_audio), 1, 5, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); - timebar->attach(*current_time_widget, 0, 1, 0, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); - timebar->attach(*framedial, 0, 1, 2, 3, Gtk::SHRINK, Gtk::SHRINK); - timebar->attach(*timeslider, 1, 3, 1, 2, Gtk::FILL|Gtk::SHRINK, Gtk::FILL|Gtk::SHRINK); - timebar->attach(*widget_kf_list, 1, 3, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::SHRINK); - timebar->attach(*time_window_scroll, 1, 3, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); - timebar->attach(*keyframedial, 3, 4, 0, 2, Gtk::SHRINK, Gtk::SHRINK); - timebar->attach(*animatebutton, 4, 5, 0, 2, Gtk::SHRINK, Gtk::SHRINK); - //timebar->attach(*keyframebutton, 1, 2, 3, 4, Gtk::SHRINK, Gtk::SHRINK); - - timebar->show(); - - return timebar; -} - -Gtk::Widget * -CanvasView::create_work_area() -{ - work_area=std::auto_ptr(new class studio::WorkArea(canvas_interface_)); - work_area->set_instance(get_instance()); - work_area->set_canvas(get_canvas()); - work_area->set_canvas_view(this); - work_area->set_progress_callback(get_ui_interface().get()); - work_area->signal_popup_menu().connect(sigc::mem_fun(*this, &studio::CanvasView::popup_main_menu)); - work_area->show(); - return work_area.get(); -} - -Gtk::Widget* -CanvasView::create_status_bar() -{ - Gtk::Image *icon; - Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon"); - cancel=false; - - // Create the status bar at the bottom of the window - Gtk::Table *statusbartable= manage(new class Gtk::Table(5, 1, false)); -// statusbar = manage(new class Gtk::Statusbar()); // This is already done at construction - progressbar =manage(new class Gtk::ProgressBar()); - SMALL_BUTTON(stopbutton,"gtk-stop",_("Stop")); - SMALL_BUTTON(refreshbutton,"gtk-refresh",_("Refresh")); - //SMALL_BUTTON(treetogglebutton,"gtk-go-down",_("Toggle Layer Tree")); -// NEW_SMALL_BUTTON(raisebutton,"gtk-go-up",_("Raise Layer")); -// NEW_SMALL_BUTTON(lowerbutton,"gtk-go-down",_("Lower Layer")); - //statusbartable->attach(*treetogglebutton, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); -// statusbartable->attach(*lowerbutton, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); -// statusbartable->attach(*raisebutton, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - - statusbartable->attach(*statusbar, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); - statusbartable->attach(*progressbar, 2, 3, 0, 1, Gtk::SHRINK, Gtk::EXPAND|Gtk::FILL, 0, 0); - statusbartable->attach(*refreshbutton, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - statusbartable->attach(*stopbutton, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0); - statusbar->set_has_resize_grip(false); - statusbar->show(); - stopbutton->show(); - refreshbutton->show(); - progressbar->show(); - stopbutton->set_sensitive(false); - - //refreshbutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_refresh_pressed)); - //stopbutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::stop)); - //treetogglebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::toggle_tables)); - - refreshbutton->signal_clicked().connect(SLOT_EVENT(EVENT_REFRESH)); - stopbutton->signal_clicked().connect(SLOT_EVENT(EVENT_STOP)); - - statusbartable->show_all(); - return statusbartable; -} - -Gtk::Widget* -CanvasView::create_display_bar() -{ - displaybar = manage(new class Gtk::Table(16, 1, false)); - Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon_16x16"); - // Setup the ToggleDuckDial widget - toggleducksdial = Gtk::manage(new class ToggleDucksDial(iconsize)); - - Duck::Type m = work_area->get_type_mask(); - toggleducksdial->update_toggles(m); - - toggleducksdial->signal_ducks_position().connect( - sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_POSITION) - ); - toggleducksdial->signal_ducks_vertex().connect( - sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_VERTEX) - ); - toggleducksdial->signal_ducks_tangent().connect( - sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_TANGENT) - ); - toggleducksdial->signal_ducks_radius().connect( - sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_RADIUS) - ); - toggleducksdial->signal_ducks_width().connect( - sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_WIDTH) - ); - toggleducksdial->signal_ducks_angle().connect( - sigc::bind(sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask),Duck::TYPE_ANGLE) - ); - toggleducksdial->show(); - - // Set up the ResolutionDial widget - resolutiondial=Gtk::manage(new class ResolutionDial(iconsize)); - - resolutiondial->update_lowres(work_area->get_low_resolution_flag()); - resolutiondial->signal_increase_resolution().connect( - sigc::mem_fun(*this, &studio::CanvasView::decrease_low_res_pixel_size)); - resolutiondial->signal_decrease_resolution().connect( - sigc::mem_fun(*this, &studio::CanvasView::increase_low_res_pixel_size)); - resolutiondial->signal_use_low_resolution().connect( - sigc::mem_fun(*this, &studio::CanvasView::toggle_low_res_pixel_flag)); - resolutiondial->show(); - - // Set up some separators - Gtk::VSeparator *separator1 = Gtk::manage(new class Gtk::VSeparator()); - separator1->show(); - Gtk::VSeparator *separator2 = Gtk::manage(new class Gtk::VSeparator()); - separator2->show(); - Gtk::VSeparator *separator3 = Gtk::manage(new class Gtk::VSeparator()); - separator3->show(); - Gtk::VSeparator *separator4 = Gtk::manage(new class Gtk::VSeparator()); - separator4->show(); - Gtk::VSeparator *separator5 = Gtk::manage(new class Gtk::VSeparator()); - separator5->show(); - - // Set up quality spin button - quality_spin=Gtk::manage(new class Gtk::SpinButton(quality_adjustment_)); - quality_spin->signal_value_changed().connect( - sigc::mem_fun(*this, &studio::CanvasView::update_quality)); - tooltips.set_tip(*quality_spin, _("Quality (lower is better)")); - quality_spin->show(); - - // Set up the show grid toggle button - show_grid = Gtk::manage(new class Gtk::ToggleButton()); - show_grid->set_active(work_area->grid_status()); - Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID("synfig-toggle_show_grid"), iconsize)); - icon->set_padding(0, 0); - icon->show(); - show_grid->add(*icon); - show_grid->signal_toggled().connect( - sigc::mem_fun(*this, &studio::CanvasView::toggle_show_grid)); - tooltips.set_tip(*show_grid, _("Show grid when enabled")); - show_grid->set_relief(Gtk::RELIEF_NONE); - show_grid->show(); - - // Set up the snap to grid toggle button - snap_grid = Gtk::manage(new class Gtk::ToggleButton()); - snap_grid->set_active(work_area->grid_status()); - Gtk::Image *icon2 = manage(new Gtk::Image(Gtk::StockID("synfig-toggle_snap_grid"), iconsize)); - icon2->set_padding(0, 0); - icon2->show(); - snap_grid->add(*icon2); - snap_grid->signal_toggled().connect( - sigc::mem_fun(*this, &studio::CanvasView::toggle_snap_grid)); - tooltips.set_tip(*snap_grid, _("Snap grid when enabled")); - snap_grid->set_relief(Gtk::RELIEF_NONE); - snap_grid->show(); - - // Set up the onion skin toggle button - onion_skin = Gtk::manage(new class Gtk::ToggleButton()); - onion_skin->set_active(work_area->get_onion_skin()); - Gtk::Image *icon3 = manage(new Gtk::Image(Gtk::StockID("synfig-toggle_onion_skin"), iconsize)); - icon3->set_padding(0, 0); - icon3->show(); - onion_skin->add(*icon3); - onion_skin->signal_toggled().connect( - sigc::mem_fun(*this, &studio::CanvasView::toggle_onion_skin)); - tooltips.set_tip(*onion_skin, _("Shows onion skin when enabled")); - onion_skin->set_relief(Gtk::RELIEF_NONE); - onion_skin->show(); - - // Set up past onion skin spin button - past_onion_spin=Gtk::manage(new class Gtk::SpinButton(past_onion_adjustment_)); - past_onion_spin->signal_value_changed().connect( - sigc::mem_fun(*this, &studio::CanvasView::set_onion_skins)); - tooltips.set_tip(*past_onion_spin, _("Past onion skins")); - past_onion_spin->show(); - - // Set up future onion skin spin button - future_onion_spin=Gtk::manage(new class Gtk::SpinButton(future_onion_adjustment_)); - future_onion_spin->signal_value_changed().connect( - sigc::mem_fun(*this, &studio::CanvasView::set_onion_skins)); - tooltips.set_tip(*future_onion_spin, _("Future onion skins")); - future_onion_spin->show(); - - // Setup render options dialog button - render_options_button = Gtk::manage(new class Gtk::Button()); - Gtk::Image *icon4 = manage(new Gtk::Image(Gtk::StockID("synfig-render_options"), iconsize)); - icon4->set_padding(0, 0); - icon4->show(); - render_options_button->add(*icon4); - render_options_button->signal_clicked().connect( - sigc::mem_fun0(render_settings,&studio::RenderSettings::present)); - tooltips.set_tip(*render_options_button, _("Shows the Render Settings Dialog")); - render_options_button->set_relief(Gtk::RELIEF_NONE); - render_options_button->show(); - - // Setup preview options dialog button - preview_options_button = Gtk::manage(new class Gtk::Button()); - Gtk::Image *icon5 = manage(new Gtk::Image(Gtk::StockID("synfig-preview_options"), iconsize)); - icon5->set_padding(0, 0); - icon5->show(); - preview_options_button->add(*icon5); - preview_options_button->signal_clicked().connect( - sigc::mem_fun(*this,&CanvasView::on_preview_option)); - tooltips.set_tip(*preview_options_button, _("Shows the Preview Settings Dialog")); - preview_options_button->set_relief(Gtk::RELIEF_NONE); - preview_options_button->show(); - - - displaybar->attach(*toggleducksdial, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - displaybar->attach(*separator1, 1, 2, 0, 1, Gtk::FILL, Gtk::FILL); - displaybar->attach(*resolutiondial, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - displaybar->attach(*separator2, 3, 4, 0, 1, Gtk::FILL, Gtk::FILL); - displaybar->attach(*quality_spin, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - displaybar->attach(*separator3, 5, 6, 0, 1, Gtk::FILL, Gtk::FILL); - displaybar->attach(*show_grid, 6, 7, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - displaybar->attach(*snap_grid, 7, 8, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - displaybar->attach(*separator4, 8, 9, 0, 1, Gtk::FILL, Gtk::FILL); - displaybar->attach(*past_onion_spin, 9, 10, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - displaybar->attach(*onion_skin, 10, 11, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - displaybar->attach(*future_onion_spin, 11, 12, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - displaybar->attach(*separator5, 12, 13, 0, 1, Gtk::FILL, Gtk::FILL); - displaybar->attach(*render_options_button, 13, 14, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - displaybar->attach(*preview_options_button, 14, 15, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - displaybar->show(); - - return displaybar; - -} - -void -CanvasView::on_current_time_widget_changed() -{ - set_time(current_time_widget->get_value()); - - // show the value being used - it will have been rounded to nearest frame - // this was already being done elsewhere, but only if the time was really changed; - // if the current time was 6f and the user edited it to 6.1f, then the 6.1f would - // be left in the display without the following line to fix it - current_time_widget->set_value(get_time()); - current_time_widget->set_position(-1); // leave the cursor at the end -} - -// Gtk::Widget* -// CanvasView::create_children_tree() -// { -// // Create the layer tree -// children_tree=manage(new class ChildrenTree()); -// -// // Set up the layer tree -// //children_tree->set_model(children_tree_store()); -// if(children_tree)children_tree->set_time_adjustment(time_adjustment()); -// if(children_tree)children_tree->show(); -// -// // Connect Signals -// if(children_tree)children_tree->signal_edited_value().connect(sigc::mem_fun(*this, &studio::CanvasView::on_edited_value)); -// if(children_tree)children_tree->signal_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click)); -// if(children_tree)children_tree->signal_waypoint_clicked_childrentree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview)); -// if(children_tree)children_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS)); -// -// return children_tree; -// } - -// Gtk::Widget* -// CanvasView::create_keyframe_tree() -// { -// keyframe_tree=manage(new KeyframeTree()); -// -// //keyframe_tree->get_selection()->set_mode(Gtk::SELECTION_MULTIPLE); -// //keyframe_tree->show(); -// //keyframe_tree->set_model(keyframe_tree_store()); -// keyframe_tree->set_editable(true); -// //keyframe_tree->signal_edited().connect(sigc::hide_return(sigc::mem_fun(*canvas_interface(), &synfigapp::CanvasInterface::update_keyframe))); -// -// keyframe_tree->signal_event().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_tree_event)); -// -// Gtk::ScrolledWindow *scroll_layer_tree = manage(new class Gtk::ScrolledWindow()); -// scroll_layer_tree->set_flags(Gtk::CAN_FOCUS); -// scroll_layer_tree->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); -// scroll_layer_tree->add(*keyframe_tree); -// scroll_layer_tree->set_shadow_type(Gtk::SHADOW_ETCHED_IN); -// //scroll_layer_tree->show(); -// -// -// Gtk::Table *layout_table= manage(new Gtk::Table(1, 2, false)); -// layout_table->attach(*scroll_layer_tree, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); -// -// Gtk::Image *icon; -// Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon")); -// -// NEW_SMALL_BUTTON(button_add,"gtk-add",_("New Keyframe")); -// NEW_SMALL_BUTTON(button_duplicate,"synfig-duplicate",_("Duplicate Keyframe")); -// NEW_SMALL_BUTTON(button_delete,"gtk-delete",_("Delete Keyframe")); -// -// Gtk::HBox *hbox(manage(new Gtk::HBox())); -// layout_table->attach(*hbox, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0); -// -// hbox->pack_start(*button_add,Gtk::PACK_SHRINK); -// hbox->pack_start(*button_duplicate,Gtk::PACK_SHRINK); -// hbox->pack_start(*button_delete,Gtk::PACK_SHRINK); -// -// /* -// button_raise->set_relief(Gtk::RELIEF_HALF); -// button_lower->set_relief(Gtk::RELIEF_HALF); -// button_duplicate->set_relief(Gtk::RELIEF_HALF); -// button_delete->set_relief(Gtk::RELIEF_HALF); -// */ -// -// button_add->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_add_pressed)); -// button_duplicate->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_duplicate_pressed)); -// button_delete->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_remove_pressed)); -// -// //layout_table->show_all(); -// -// keyframe_tab_child=layout_table; -// -// -// layout_table->hide(); -// -// return layout_table; -// } - -// Gtk::Widget* -// CanvasView::create_layer_tree() -// { -// // Create the layer tree -// printf("CanvasView::create_layer_tree()\n"); -// layer_tree=manage(new class LayerTree()); -// -// // Set up the layer tree -// //layer_tree->set_model(layer_tree_store()); -// layer_tree->set_time_adjustment(time_adjustment()); -// layer_tree->show(); -// -// // Connect Signals -// layer_tree->signal_layer_toggle().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_toggle)); -// layer_tree->signal_edited_value().connect(sigc::mem_fun(*this, &studio::CanvasView::on_edited_value)); -// layer_tree->signal_layer_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_user_click)); -// layer_tree->signal_param_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click)); -// layer_tree->signal_waypoint_clicked_layertree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview)); -// layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS)); -// -// layer_tree->hide(); -// return layer_tree; -// } - -void -CanvasView::init_menus() -{ -/* - mainmenu.set_accel_group(get_accel_group()); - mainmenu.set_accel_path(""); - - filemenu.set_accel_group(get_accel_group()); - filemenu.set_accel_path("/File"); - - editmenu.set_accel_group(get_accel_group()); - editmenu.set_accel_path("/Edit"); - - layermenu.set_accel_group(get_accel_group()); - layermenu.set_accel_path("/Layer"); -*/ - //cache the position of desired widgets - - /*Menus to worry about: - - filemenu - - editmenu - - layermenu - - duckmaskmenu - - mainmenu - - canvasmenu - - viewmenu - */ - action_group = Gtk::ActionGroup::create("canvasview"); - - //action_group->add( Gtk::Action::create("MenuFile", _("_File")) ); - action_group->add( Gtk::Action::create("new", Gtk::Stock::NEW), - sigc::hide_return(sigc::ptr_fun(&studio::App::new_instance)) - ); - action_group->add( Gtk::Action::create("open", Gtk::Stock::OPEN), - sigc::hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::open)) - ); - action_group->add( Gtk::Action::create("save", Gtk::Stock::SAVE), - hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::save)) - ); - action_group->add( Gtk::Action::create("save-as", Gtk::Stock::SAVE_AS), - sigc::hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::dialog_save_as)) - ); - action_group->add( Gtk::Action::create("revert", Gtk::Stock::REVERT_TO_SAVED), - sigc::hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::safe_revert)) - ); - action_group->add( Gtk::Action::create("cvs-add", Gtk::StockID("synfig-cvs_add")), - sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_add)) - ); - action_group->add( Gtk::Action::create("cvs-update", Gtk::StockID("synfig-cvs_update")), - sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_update)) - ); - action_group->add( Gtk::Action::create("cvs-revert", Gtk::StockID("synfig-cvs_revert")), - sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_revert)) - ); - action_group->add( Gtk::Action::create("cvs-commit", Gtk::StockID("synfig-cvs_commit")), - sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_commit)) - ); - action_group->add( Gtk::Action::create("import", _("Import")), - sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::image_import)) - ); - action_group->add( Gtk::Action::create("render", _("Render")), - sigc::mem_fun0(render_settings,&studio::RenderSettings::present) - ); - action_group->add( Gtk::Action::create("preview", _("Preview")), - sigc::mem_fun(*this,&CanvasView::on_preview_option) - ); - action_group->add( Gtk::Action::create("sound", _("Sound File")), - sigc::mem_fun(*this,&CanvasView::on_audio_option) - ); - action_group->add( Gtk::Action::create("options", _("Options")), - sigc::mem_fun0(canvas_options,&studio::CanvasOptions::present) - ); - action_group->add( Gtk::Action::create("close", Gtk::StockID("gtk-close"), _("Close Window")), - sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close_view)) - ); - action_group->add( Gtk::Action::create("close-document", Gtk::StockID("gtk-close"), _("Close Document")), - sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close_instance)) - ); - action_group->add( Gtk::Action::create("quit", Gtk::StockID("gtk-quit"), _("Quit")), - sigc::hide_return(sigc::ptr_fun(&studio::App::quit)) - ); - - //action_group->add( Gtk::Action::create("undo", Gtk::StockID("gtk-undo")), - // SLOT_EVENT(EVENT_UNDO) - //); - - //action_group->add( Gtk::Action::create("redo", Gtk::StockID("gtk-redo")), - // SLOT_EVENT(EVENT_REDO) - //); - - action_group->add( Gtk::Action::create("select-all-ducks", _("Select All Ducks")), - sigc::mem_fun(*work_area,&studio::WorkArea::select_all_ducks) - ); - - action_group->add( Gtk::Action::create("unselect-all-ducks", _("Unselect All Ducks")), - sigc::mem_fun(*work_area,&studio::WorkArea::unselect_all_ducks) - ); - - action_group->add( Gtk::Action::create("select-all-layers", _("Select All Layers")), - sigc::mem_fun(*this,&CanvasView::on_select_layers) - ); - - action_group->add( Gtk::Action::create("unselect-all-layers", _("Unselect All Layers")), - sigc::mem_fun(*this,&CanvasView::on_unselect_layers) - ); - - action_group->add( Gtk::Action::create("stop", Gtk::StockID("gtk-stop")), - SLOT_EVENT(EVENT_STOP) - ); - - action_group->add( Gtk::Action::create("refresh", Gtk::StockID("gtk-refresh")), - SLOT_EVENT(EVENT_REFRESH) - ); - - action_group->add( Gtk::Action::create("properties", Gtk::StockID("gtk-properties")), - sigc::mem_fun0(canvas_properties,&studio::CanvasProperties::present) - ); - - // Preview Quality Menu - { - int i; - action_group->add( Gtk::RadioAction::create(quality_group,"quality-00", _("Use Parametric Renderer")), - sigc::bind( - sigc::mem_fun(*work_area, &studio::WorkArea::set_quality), - 0 - ) - ); - for(i=1;i<=10;i++) - { - String note; - if (i == 1) note = _(" (best)"); - if (i == 10) note = _(" (fastest)"); - Glib::RefPtr action(Gtk::RadioAction::create(quality_group,strprintf("quality-%02d",i), - strprintf(_("Set Quality to %d"),i) + note)); - if (i==8) // default quality - { - action->set_active(); - work_area->set_quality(i); - } - action_group->add( action, - sigc::bind( - sigc::mem_fun(*this, &studio::CanvasView::set_quality), - i - ) - ); - } - } - - // Low-Res Quality Menu - { - int i; - for(list::iterator iter = CanvasView::get_pixel_sizes().begin(); iter != CanvasView::get_pixel_sizes().end(); iter++) - { - i = *iter; - Glib::RefPtr action(Gtk::RadioAction::create(low_res_pixel_size_group,strprintf("lowres-pixel-%d",i), - strprintf(_("Set Low-Res pixel size to %d"),i))); - if(i==2) // default pixel size - { - action->set_active(); - work_area->set_low_res_pixel_size(i); - } - action_group->add( action, - sigc::bind( - sigc::mem_fun(*work_area, &studio::WorkArea::set_low_res_pixel_size), - i - ) - ); - } - - Glib::RefPtr action; - - action=Gtk::Action::create("decrease-low-res-pixel-size", _("Decrease Low-Res Pixel Size")); - action_group->add( action,sigc::mem_fun(this, &studio::CanvasView::decrease_low_res_pixel_size)); - - action=Gtk::Action::create("increase-low-res-pixel-size", _("Increase Low-Res Pixel Size")); - action_group->add( action, sigc::mem_fun(this, &studio::CanvasView::increase_low_res_pixel_size)); - - } - - action_group->add( Gtk::Action::create("play", Gtk::Stock::MEDIA_PLAY), - sigc::mem_fun(*this, &studio::CanvasView::play) - ); - - action_group->add( Gtk::Action::create("dialog-flipbook", _("Preview Window")), - sigc::mem_fun0(*preview_dialog, &studio::Dialog_Preview::present) - ); - - { - Glib::RefPtr action; - - grid_show_toggle = Gtk::ToggleAction::create("toggle-grid-show", _("Show Grid")); - grid_show_toggle->set_active(work_area->grid_status()); - action_group->add(grid_show_toggle, sigc::mem_fun(*this, &studio::CanvasView::toggle_show_grid)); - - grid_snap_toggle = Gtk::ToggleAction::create("toggle-grid-snap", _("Snap to Grid")); - grid_snap_toggle->set_active(work_area->get_grid_snap()); - action_group->add(grid_snap_toggle, sigc::mem_fun(*this, &studio::CanvasView::toggle_snap_grid)); - - action = Gtk::ToggleAction::create("toggle-guide-show", _("Show Guides")); - action->set_active(work_area->get_show_guides()); - action_group->add(action, sigc::mem_fun(*work_area, &studio::WorkArea::toggle_guide_snap)); - - action = Gtk::ToggleAction::create("toggle-low-res", _("Use Low-Res")); - action->set_active(work_area->get_low_resolution_flag()); - action_group->add(action, sigc::mem_fun(*this, &studio::CanvasView::toggle_low_res_pixel_flag)); - - action = Gtk::ToggleAction::create("toggle-onion-skin", _("Show Onion Skin")); - action->set_active(work_area->get_onion_skin()); - action_group->add(action, sigc::mem_fun(*this, &studio::CanvasView::toggle_onion_skin)); - } - - action_group->add( Gtk::Action::create("canvas-zoom-fit", Gtk::StockID("gtk-zoom-fit")), - sigc::mem_fun(*work_area, &studio::WorkArea::zoom_fit) - ); - action_group->add( Gtk::Action::create("canvas-zoom-100", Gtk::StockID("gtk-zoom-100")), - sigc::mem_fun(*work_area, &studio::WorkArea::zoom_norm) - ); - - { - Glib::RefPtr action; - - action=Gtk::Action::create("seek-next-frame", Gtk::Stock::GO_FORWARD,_("Next Frame"),_("Next Frame")); - action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame),1)); - action=Gtk::Action::create("seek-prev-frame", Gtk::Stock::GO_BACK,_("Prev Frame"),_("Prev Frame")); - action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_frame),-1)); - - action=Gtk::Action::create("seek-next-second", Gtk::Stock::GO_FORWARD,_("Seek Forward"),_("Seek Forward")); - action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time(1))); - action=Gtk::Action::create("seek-prev-second", Gtk::Stock::GO_BACK,_("Seek Backward"),_("Seek Backward")); - action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time(-1))); - - action=Gtk::Action::create("seek-end", Gtk::Stock::GOTO_LAST,_("Seek to End"),_("Seek to End")); - action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time::end())); - - action=Gtk::Action::create("seek-begin", Gtk::Stock::GOTO_FIRST,_("Seek to Begin"),_("Seek to Begin")); - action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek_time),Time::begin())); - - action=Gtk::Action::create("jump-next-keyframe", Gtk::Stock::GO_FORWARD,_("Jump to Next Keyframe"),_("Jump to Next Keyframe")); - action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe)); - - action=Gtk::Action::create("jump-prev-keyframe", Gtk::Stock::GO_BACK,_("Jump to Prev Keyframe"),_("Jump to Prev Keyframe")); - action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe)); - - action=Gtk::Action::create("canvas-zoom-in", Gtk::Stock::ZOOM_IN); - action_group->add( action,sigc::mem_fun(*work_area, &studio::WorkArea::zoom_in)); - - action=Gtk::Action::create("canvas-zoom-out", Gtk::Stock::ZOOM_OUT); - action_group->add( action, sigc::mem_fun(*work_area, &studio::WorkArea::zoom_out) ); - - action=Gtk::Action::create("time-zoom-in", Gtk::Stock::ZOOM_IN, _("Zoom In on Timeline")); - action_group->add( action, sigc::mem_fun(*this, &studio::CanvasView::time_zoom_in) ); - - action=Gtk::Action::create("time-zoom-out", Gtk::Stock::ZOOM_OUT, _("Zoom Out on Timeline")); - action_group->add( action, sigc::mem_fun(*this, &studio::CanvasView::time_zoom_out) ); - - } - - { - Glib::RefPtr action; - -#define DUCK_MASK(lower,upper,string) \ - action=Gtk::ToggleAction::create("mask-" #lower "-ducks", string); \ - action->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_##upper)); \ - action_group->add(action, \ - sigc::bind( \ - sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), \ - Duck::TYPE_##upper)) - - DUCK_MASK(position,POSITION,_("Show Position Ducks")); - DUCK_MASK(tangent,TANGENT,_("Show Tangent Ducks")); - DUCK_MASK(vertex,VERTEX,_("Show Vertex Ducks")); - DUCK_MASK(radius,RADIUS,_("Show Radius Ducks")); - DUCK_MASK(width,WIDTH,_("Show Width Ducks")); - DUCK_MASK(angle,ANGLE,_("Show Angle Ducks")); - -#undef DUCK_MASK - } - - add_accel_group(App::ui_manager()->get_accel_group()); - -/* // Here is where we add the actions that may have conflicting - // keyboard accelerators. - { - Glib::RefPtr accel_action_group(Gtk::ActionGroup::create("canvas_view")); - Glib::RefPtr action; - - action=Gtk::Action::create("seek-next-frame", Gtk::StockID("gtk-forward"),_("Next Frame"),_("Next Frame")); - accel_action_group->add(action,sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek),1)); - - action=Gtk::Action::create("seek-prev-frame", Gtk::StockID("gtk-forward"),_("Prev Frame"),_("Prev Frame")); - accel_action_group->add( action, sigc::bind(sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::seek),-1)); - - action=Gtk::Action::create("jump-next-keyframe", Gtk::StockID("gtk-forward"),_("Jump to Next Keyframe"),_("Jump to Next Keyframe")); - accel_action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe)); - - action=Gtk::Action::create("jump-prev-keyframe", Gtk::StockID("gtk-back"),_("Jump to Prev Keyframe"),_("Jump to Prev Keyframe")); - accel_action_group->add( action,sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe)); - - action=Gtk::Action::create("canvas-zoom-in", Gtk::StockID("gtk-zoom-in")); - accel_action_group->add( action,sigc::mem_fun(*work_area, &studio::WorkArea::zoom_in)); - - action=Gtk::Action::create("canvas-zoom-out", Gtk::StockID("gtk-zoom-out")); - accel_action_group->add( action, sigc::mem_fun(*work_area, &studio::WorkArea::zoom_out) ); - - action=Gtk::Action::create("time-zoom-in", Gtk::StockID("gtk-zoom-in"), _("Zoom In on Timeline")); - accel_action_group->add( action, sigc::mem_fun(*this, &studio::CanvasView::time_zoom_in) ); - - action=Gtk::Action::create("time-zoom-out", Gtk::StockID("gtk-zoom-out"), _("Zoom Out on Timeline")); - accel_action_group->add( action, sigc::mem_fun(*this, &studio::CanvasView::time_zoom_out) ); - - Glib::RefPtr accel_ui_manager(Gtk::UIManager::create()); - - Glib::ustring ui_info = - " - - - - - - - - - - - "; - - accel_ui_manager->add_ui_from_string(ui_info); - add_accel_group(accel_ui_manager->get_accel_group()); - - accel_ui_manager->insert_action_group(accel_action_group); - set_ref_obj("accel_ui_manager",accel_ui_manager); - set_ref_obj("accel_action_group",accel_action_group); - } -*/ - -#if 0 -// -// //Test some key stuff -// -// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-save"), -// hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::save)))); -// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-save-as"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_save_as)))); -// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-revert-to-saved"),hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::safe_revert)))); -// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// -// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_add"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_add)))); -// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_update"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_update)))); -// filemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-cvs_commit"),sigc::hide_return(sigc::mem_fun(*get_instance(), &studio::Instance::dialog_cvs_commit)))); -// -// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Import..."),Gtk::AccelKey('I',Gdk::CONTROL_MASK),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::image_import)))); -// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Render"),Gtk::AccelKey("F9"), -// sigc::mem_fun(render_settings,&studio::RenderSettings::present) -// )); -// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Preview"),Gtk::AccelKey("F11"), -// sigc::mem_fun(*this,&CanvasView::on_preview_option) -// )); -// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Sound File"), -// sigc::mem_fun(*this,&CanvasView::on_audio_option) -// )); -// -// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Options"),Gtk::AccelKey("F12"), -// sigc::mem_fun(canvas_options,&studio::CanvasOptions::present) -// )); -// filemenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Close View"), -// sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close_view)) -// )); -// filemenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Close Document"), -// sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close_document)) -// )); -// -// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-undo"),Gtk::AccelKey('Z',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_UNDO))); -// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-redo"),Gtk::AccelKey('R',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_REDO))); -// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-cut"),NOT_IMPLEMENTED_SLOT)); -// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-copy"),NOT_IMPLEMENTED_SLOT)); -// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-paste"),NOT_IMPLEMENTED_SLOT)); -// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Ducks"),Gtk::AccelKey('E',Gdk::CONTROL_MASK),sigc::mem_fun(*work_area,&studio::WorkArea::select_all_ducks))); -// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Unselect All Ducks"),Gtk::AccelKey('E',Gdk::CONTROL_MASK),sigc::mem_fun(*work_area,&studio::WorkArea::unselect_all_ducks))); -// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Layers"),Gtk::AccelKey('A',Gdk::CONTROL_MASK),sigc::mem_fun(*this,&CanvasView::on_select_layers))); -// editmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Unselect All Layers"),Gtk::AccelKey('D',Gdk::CONTROL_MASK),sigc::mem_fun(*this,&CanvasView::on_unselect_layers))); -// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// -// //editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-stop"),Gtk::AccelKey(GDK_Escape,static_cast(0)),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::stop)))); -// //editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-refresh"),Gtk::AccelKey('k',Gdk::CONTROL_MASK),sigc::hide_return(sigc::mem_fun(*this, &studio::CanvasView::on_refresh_pressed)))); -// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-stop"),Gtk::AccelKey(GDK_Escape,static_cast(0)),SLOT_EVENT(EVENT_STOP))); -// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-refresh"),Gtk::AccelKey('k',Gdk::CONTROL_MASK),SLOT_EVENT(EVENT_REFRESH))); -// editmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// editmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-properties"),Gtk::AccelKey("F8"), -// sigc::mem_fun(canvas_properties,&studio::CanvasProperties::present) -// )); -// -// build_new_layer_menu(newlayermenu); -// layermenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("New"),newlayermenu)); -// -// -// { -// synfigapp::Action::ParamList param_list; -// param_list.add("canvas",Canvas::Handle(get_canvas())); -// param_list.add("canvas_interface",canvas_interface()); -// add_actions_to_menu(&canvasmenu, param_list,synfigapp::Action::CATEGORY_CANVAS); -// } -// -// -// //canvasmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Keyframe Dialog"),sigc::mem_fun(keyframe_dialog,&studio::Dialog_Keyframe::present))); -// -// // Duck Mask Menu -// if(1) -// { -// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem()); -// -// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Position Ducks"),Gtk::AccelKey('1',Gdk::MOD1_MASK))); -// duck_mask_position=static_cast(&duckmaskmenu.items().back()); -// duck_mask_position->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_POSITION)); -// duck_mask_position->signal_toggled().connect( -// sigc::bind( -// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), -// Duck::TYPE_POSITION -// ) -// ); -// -// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Vertex Ducks"),Gtk::AccelKey('2',Gdk::MOD1_MASK))); -// duck_mask_vertex=static_cast(&duckmaskmenu.items().back()); -// duck_mask_vertex->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_VERTEX)); -// duck_mask_vertex->signal_toggled().connect( -// sigc::bind( -// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), -// Duck::TYPE_VERTEX -// ) -// ); -// -// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Tangent Ducks"),Gtk::AccelKey('3',Gdk::MOD1_MASK))); -// duck_mask_tangent=static_cast(&duckmaskmenu.items().back()); -// duck_mask_tangent->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_TANGENT)); -// duck_mask_tangent->signal_toggled().connect( -// sigc::bind( -// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), -// Duck::TYPE_TANGENT -// ) -// ); -// -// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Radius Ducks"),Gtk::AccelKey('4',Gdk::MOD1_MASK))); -// duck_mask_radius=static_cast(&duckmaskmenu.items().back()); -// duck_mask_radius->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_RADIUS)); -// duck_mask_radius->signal_toggled().connect( -// sigc::bind( -// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), -// Duck::TYPE_RADIUS -// ) -// ); -// -// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Width Ducks"),Gtk::AccelKey('5',Gdk::MOD1_MASK))); -// duck_mask_width=static_cast(&duckmaskmenu.items().back()); -// duck_mask_width->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_WIDTH)); -// duck_mask_width->signal_toggled().connect( -// sigc::bind( -// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), -// Duck::TYPE_WIDTH -// ) -// ); -// -// duckmaskmenu.items().push_back(Gtk::Menu_Helpers::CheckMenuElem(_("Angle Ducks"),Gtk::AccelKey('6',Gdk::MOD1_MASK))); -// duck_mask_angle=static_cast(&duckmaskmenu.items().back()); -// duck_mask_angle->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_ANGLE)); -// duck_mask_angle->signal_toggled().connect( -// sigc::bind( -// sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), -// Duck::TYPE_ANGLE -// ) -// ); -// -// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Mask Ducks"),duckmaskmenu)); -// } -// -// // Preview Quality Menu -// if(1) -// { -// qualitymenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem()); -// int i; -// qualitymenu.items().push_back(Gtk::Menu_Helpers::MenuElem(strprintf(_("Use Parametric Renderer"),0), -// sigc::bind( -// sigc::mem_fun(*work_area, &studio::WorkArea::set_quality), -// 0 -// ) -// )); -// for(i=1;i<=10;i++) -// { -// qualitymenu.items().push_back(Gtk::Menu_Helpers::MenuElem(strprintf(_("Set Quality to %d"),i),Gtk::AccelKey('0'+(i%10),Gdk::CONTROL_MASK), -// sigc::bind( -// sigc::mem_fun(*work_area, &studio::WorkArea::set_quality), -// i -// ) -// )); -// } -// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Preview Quality"),qualitymenu)); -// } -// -// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::MEDIA_PLAY, -// sigc::mem_fun(*this, &studio::CanvasView::play))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("Flipbook Dialog"), -// sigc::mem_fun(*preview_dialog, &studio::Dialog_Preview::present))); -// -// viewmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// -// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Grid Show"),Gtk::AccelKey('g',Gdk::CONTROL_MASK), -// sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Grid Snap"),Gtk::AccelKey('l',Gdk::CONTROL_MASK), -// sigc::mem_fun(*work_area, &studio::WorkArea::toggle_grid_snap))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Guide Snap"),Gtk::AccelKey('k',Gdk::CONTROL_MASK), -// sigc::mem_fun(*work_area, &studio::WorkArea::toggle_guide_snap))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Toggle Low-Res"),Gtk::AccelKey('`',Gdk::CONTROL_MASK), -// sigc::mem_fun(*work_area, &studio::WorkArea::toggle_low_resolution_flag))); -// -// viewmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// -// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-in"),Gtk::AccelKey('=',static_cast(0)), -// sigc::mem_fun(*work_area, &studio::WorkArea::zoom_in))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-out"),Gtk::AccelKey('-',static_cast(0)), -// sigc::mem_fun(*work_area, &studio::WorkArea::zoom_out))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-fit"), -// sigc::mem_fun(*work_area, &studio::WorkArea::zoom_fit))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-100"),Gtk::AccelKey('`',static_cast(0)), -// sigc::mem_fun(*work_area, &studio::WorkArea::zoom_norm))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// -// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-in"),Gtk::AccelKey('+',static_cast(0)), -// sigc::mem_fun(*this, &studio::CanvasView::time_zoom_in))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-zoom-out"),Gtk::AccelKey('_',static_cast(0)), -// sigc::mem_fun(*this, &studio::CanvasView::time_zoom_out))); -// -// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Jump to Next Keyframe"),Gtk::AccelKey(']',static_cast(0)), -// sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_next_keyframe))); -// viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Jump to Prev Keyframe"),Gtk::AccelKey('[',static_cast(0)), -// sigc::mem_fun(*canvas_interface().get(), &synfigapp::CanvasInterface::jump_to_prev_keyframe))); -// -// mainmenu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem()); -// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_File"),filemenu)); -// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Edit"),editmenu)); -// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_View"),viewmenu)); -// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Canvas"),canvasmenu)); -// mainmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Layer"),layermenu)); -// -// mainmenu.accelerate(*this); -// -///* -// { -// -// trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("New Waypoint"),NOT_IMPLEMENTED_SLOT)); -// trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Delete Waypoint"),NOT_IMPLEMENTED_SLOT)); -// trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Export"),NOT_IMPLEMENTED_SLOT)); -// trackmenu.items().push_back(Gtk::Menu_Helpers::SeparatorElem()); -// trackmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Properties"),NOT_IMPLEMENTED_SLOT)); -// } -//*/ -// mainmenu.show(); -// filemenu.show(); -// editmenu.show(); -// canvasmenu.show(); -// layermenu.show(); -// -// keyframemenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-properties"), -// sigc::mem_fun(*this,&studio::CanvasView::show_keyframe_dialog) -// )); -// -// -// get_accel_group()->unlock(); -// -// //Set the accelerator paths for all the menus -// filemenu.set_accel_path("/File"); -// editmenu.set_accel_path("/Edit"); -// layermenu.set_accel_path("/Layer"); -// //mainmenu.set_accel_path(""); -// canvasmenu.set_accel_path("/Canvas"); -// viewmenu.set_accel_path("/View"); -// duckmaskmenu.set_accel_path("/DuckMask"); -#endif -} - -void -CanvasView::on_select_layers() -{ - Canvas::Handle canvas(get_canvas()); - for (CanvasBase::iterator iter = canvas->begin(); iter != canvas->end(); iter++) - layer_tree->select_all_children_layers(*iter); -} - -void -CanvasView::on_unselect_layers() -{ - layer_tree->clear_selected_layers(); -} - -void -CanvasView::show_keyframe_dialog() -{ - Glib::RefPtr selection(keyframe_tree->get_selection()); - if(selection->get_selected()) - { - Gtk::TreeRow row(*selection->get_selected()); - - Keyframe keyframe(row[keyframe_tree->model.keyframe]); - - keyframe_dialog.set_keyframe(keyframe); - keyframe_dialog.present(); - } -} - -void -CanvasView::add_layer(synfig::String x) -{ - Canvas::Handle canvas; - - synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers()); - - int target_depth(0); - - if(layer_list.empty()) - { - canvas=get_canvas(); - } - else - { - canvas=(*layer_list.begin())->get_canvas(); - target_depth=canvas->get_depth(*layer_list.begin()); - } - - Layer::Handle layer(canvas_interface()->add_layer_to(x,canvas,target_depth)); - if(layer) - { - get_selection_manager()->clear_selected_layers(); - get_selection_manager()->set_selected_layer(layer); - } -} - -void -CanvasView::popup_layer_menu(synfig::Layer::Handle layer) -{ - //Gtk::Menu* menu(manage(new Gtk::Menu)); - Gtk::Menu* menu(¶mmenu); - menu->items().clear(); - - synfigapp::Action::ParamList param_list; - param_list.add("time",canvas_interface()->get_time()); - param_list.add("canvas",Canvas::Handle(layer->get_canvas())); - param_list.add("canvas_interface",canvas_interface()); - param_list.add("layer",layer); - - //Gtk::Menu *newlayers(manage(new Gtk::Menu())); - //build_new_layer_menu(*newlayers); - - //parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("New Layer"),*newlayers)); - - if(layer->get_name()=="PasteCanvas") - { - menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Children"), - sigc::bind( - sigc::mem_fun( - *layer_tree, - &studio::LayerTree::select_all_children_layers - ), - layer - ) - )); - } - - add_actions_to_menu(menu, param_list,synfigapp::Action::CATEGORY_LAYER); - - menu->popup(3,gtk_get_current_event_time()); -} - -void -CanvasView::register_layer_type(synfig::Layer::Book::value_type &/*lyr*/,std::map* /*category_map*/) -{ -/* if(lyr.second.category==CATEGORY_DO_NOT_USE) - return; - - if(category_map->count(lyr.second.category)==0) - (*category_map)[lyr.second.category]=manage(new Gtk::Menu()); - - (*category_map)[lyr.second.category]->items().push_back(Gtk::Menu_Helpers::MenuElem(lyr.second.local_name, - sigc::hide_return( - sigc::bind( - sigc::mem_fun(*this,&studio::CanvasView::add_layer), - lyr.first - ) - ) - )); -*/ -} - -void -CanvasView::build_new_layer_menu(Gtk::Menu &/*menu*/) -{ -/* - std::map category_map; - - std::for_each( - synfig::Layer::book().begin(), - synfig::Layer::book().end(), - sigc::bind( - sigc::mem_fun( - *this, - &studio::CanvasView::register_layer_type - ), - &category_map - ) - ); - - menu.items().clear(); - menu.items().push_back(Gtk::Menu_Helpers::TearoffMenuElem()); - - std::map::iterator iter; - for(iter=category_map.begin();iter!=category_map.end();++iter) - menu.items().push_back(Gtk::Menu_Helpers::MenuElem(iter->first,*iter->second)); - - menu.show(); -*/ -} - -void -CanvasView::popup_main_menu() -{ - //mainmenu.popup(0,gtk_get_current_event_time()); - Gtk::Menu* menu = dynamic_cast(App::ui_manager()->get_widget("/menu-main")); - if(menu) - { - //menu->set_accel_group(App::ui_manager()->get_accel_group()); - //menu->accelerate(*this); - menu->popup(0,gtk_get_current_event_time()); - } -} - -void -CanvasView::on_refresh_pressed() -{ - rebuild_tables(); - rebuild_ducks(); - work_area->queue_render_preview(); -} - -void -CanvasView::workarea_layer_selected(synfig::Layer::Handle layer) -{ - get_selection_manager()->clear_selected_layers(); - if(layer) - get_selection_manager()->set_selected_layer(layer); -} - -void -CanvasView::refresh_rend_desc() -{ - current_time_widget->set_fps(get_canvas()->rend_desc().get_frame_rate()); - - //???? - //synfig::info("Canvasview: Refreshing render desc info"); - if(!get_time().is_equal(time_adjustment().get_value())) - { - time_adjustment().set_value(get_time()); - time_adjustment().value_changed(); - } - - Time length(get_canvas()->rend_desc().get_time_end()-get_canvas()->rend_desc().get_time_start()); - if(lengthset_global_fps(get_canvas()->rend_desc().get_frame_rate()); - - //set the beginning and ending time of the time slider - Time begin_time=get_canvas()->rend_desc().get_time_start(); - Time end_time=get_canvas()->rend_desc().get_time_end(); - - // Setup the time_window adjustment - time_window_adjustment().set_lower(begin_time); - time_window_adjustment().set_upper(end_time); - time_window_adjustment().set_step_increment(synfig::Time(1.0/get_canvas()->rend_desc().get_frame_rate())); - - //Time length(get_canvas()->rend_desc().get_time_end()-get_canvas()->rend_desc().get_time_start()); - if(length < time_window_adjustment().get_page_size()) - { - time_window_adjustment().set_page_increment(length); - time_window_adjustment().set_page_size(length); - } - - /*synfig::info("w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n", - &time_window_adjustment_, time_window_adjustment_.get_lower(), - time_window_adjustment_.get_upper(),time_window_adjustment_.get_value(), - time_window_adjustment_.get_page_size(),time_window_adjustment_.get_child_adjustment() - );*/ - - time_window_adjustment().changed(); //only non-value stuff was changed - - // Setup the time adjustment - - //NOTE THESE TWO SHOULD BE CHANGED BY THE changed() CALL ABOVE - //time_adjustment().set_lower(time_window_adjustment().get_value()); - //time_adjustment().set_upper(time_window_adjustment().get_value()+time_window_adjustment().get_page_size()); - -// time_adjustment().set_lower(get_canvas()->rend_desc().get_time_start()); -// time_adjustment().set_upper(get_canvas()->rend_desc().get_time_end()); - time_adjustment().set_step_increment(synfig::Time(1.0/get_canvas()->rend_desc().get_frame_rate())); - time_adjustment().set_page_increment(synfig::Time(1.0)); - time_adjustment().set_page_size(0); - - time_adjustment().changed(); - - /*synfig::info("w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n", - &time_window_adjustment_, time_window_adjustment_.get_lower(), - time_window_adjustment_.get_upper(),time_window_adjustment_.get_value(), - time_window_adjustment_.get_page_size(),time_window_adjustment_.get_child_adjustment() - ); */ - - if(begin_time==end_time) - { - hide_timebar(); - } - else - { - show_timebar(); - } - - //clamp time to big bounds... - if(time_window_adjustment().get_value() < begin_time) - { - time_window_adjustment().set_value(begin_time); - time_window_adjustment().value_changed(); - } - - if(time_window_adjustment().get_value() + time_window_adjustment().get_page_size() > end_time) - { - time_window_adjustment().set_value(end_time - time_window_adjustment().get_page_size()); - time_window_adjustment().value_changed(); - } - - if(time_adjustment().get_value() < begin_time) - { - time_adjustment().set_value(begin_time); - time_adjustment().value_changed(); - } - - if(time_adjustment().get_value() > end_time) - { - time_adjustment().set_value(end_time); - time_adjustment().value_changed(); - } - - /*synfig::info("Time stats: \n" - "w: %p - [%.3f,%.3f] (%.3f,%.3f) child: %p\n" - "t: %p - [%.3f,%.3f] %.3f", - &time_window_adjustment_, time_window_adjustment_.get_lower(), - time_window_adjustment_.get_upper(),time_window_adjustment_.get_value(), - time_window_adjustment_.get_page_size(),time_window_adjustment_.get_child_adjustment(), - &time_adjustment_,time_adjustment_.get_lower(),time_adjustment_.get_upper(), - time_adjustment_.get_value() - );*/ - - work_area->queue_render_preview(); -} - -bool -CanvasView::close_view() -{ - if(get_instance()->get_visible_canvases()==1) - close_instance(); - else - hide(); - return false; -} - -static bool _close_instance(etl::handle instance) -{ - etl::handle argh(instance); - instance->safe_close(); - synfig::info("closed"); - return false; -} - -bool -CanvasView::close_instance() -{ -#ifdef SINGLE_THREADED - if (get_work_area()->get_updating()) - { - get_work_area()->stop_updating(true); // stop and mark as cancelled - - // give the workarea chances to stop updating - Glib::signal_timeout().connect( - sigc::mem_fun(*this, &CanvasView::close_instance), - 250); - } - else -#endif - Glib::signal_timeout().connect( - sigc::bind(sigc::ptr_fun(_close_instance), - (etl::handle)get_instance()), - 250); - return false; -} - -handle -CanvasView::create(etl::loose_handle instance, etl::handle canvas) -{ - etl::handle view(new CanvasView(instance,instance->synfigapp::Instance::find_canvas_interface(canvas))); - instance->canvas_view_list().push_front(view); - instance->signal_canvas_view_created()(view.get()); - return view; -} - -void -CanvasView::update_title() -{ - string title; - - title = strprintf("%s%s\"%s\"", - ( - get_instance()->get_action_count() - ? "*" - : "" - ), ( - get_instance()->has_real_filename() - ? (etl::basename(get_instance()->get_file_name()) + " : ").c_str() - : "" - ), ( - get_canvas()->get_name().empty() - ? get_canvas()->get_id().c_str() - : get_canvas()->get_name().c_str() - )); - - if(get_instance()->synfigapp::Instance::in_repository()) - { - title+=" (CVS"; - if(get_instance()->synfigapp::Instance::is_modified()) - title+=_("-MODIFIED"); - if(get_instance()->synfigapp::Instance::is_updated()) - title+=_("-UPDATED"); - title+=')'; - } - - if(get_canvas()->is_root()) - title+=_(" (Root)"); - - set_title(title); -} - -void -CanvasView::on_hide() -{ - smach_.egress(); - Gtk::Window::on_hide(); -} - -void -CanvasView::present() -{ - grab_focus();//on_focus_in_event(0); - Gtk::Window::present(); -} - -bool -CanvasView::on_focus_in_event(GdkEventFocus*x) -{ - if(studio::App::get_selected_canvas_view()!=this) - { - if(studio::App::get_selected_canvas_view()) - { - studio::App::get_selected_canvas_view()->get_smach().process_event(EVENT_YIELD_TOOL_OPTIONS); - App::ui_manager()->remove_action_group(App::get_selected_canvas_view()->action_group); - } - - get_smach().process_event(EVENT_REFRESH_TOOL_OPTIONS); - - studio::App::set_selected_canvas_view(this); - - App::ui_manager()->insert_action_group(action_group); - } - - // HACK ... Questionable...? - if(x) - return Gtk::Window::on_focus_in_event(x); - - return true; -} - -bool -CanvasView::on_focus_out_event(GdkEventFocus*x) -{ - //App::ui_manager()->remove_action_group(action_group); - //App::ui_manager()->ensure_update(); - return Gtk::Window::on_focus_out_event(x); -} - -void -CanvasView::refresh_tables() -{ -// if(layer_tree_store_)layer_tree_store_->refresh(); -// if(children_tree_store_)children_tree_store_->refresh(); -} - -void -CanvasView::rebuild_tables() -{ -// layer_tree_store_->rebuild(); -// children_tree_store_->rebuild(); -} - -void -CanvasView::build_tables() -{ -// layer_tree_store_->rebuild(); -// children_tree_store_->rebuild(); -} - -void -CanvasView::on_layer_toggle(synfig::Layer::Handle layer) -{ - synfigapp::Action::Handle action(synfigapp::Action::create("LayerActivate")); - assert(action); - - if(!action) - return; - - action->set_param("canvas",Canvas::Handle(layer->get_canvas())); - if(!action->set_param("canvas_interface",canvas_interface())) -// if(!action->set_param("canvas_interface",get_instance()->find_canvas_interface(layer->get_canvas()))) - synfig::error("LayerActivate didn't like CanvasInterface...?"); - action->set_param("time",get_time()); - action->set_param("layer",layer); - action->set_param("new_status",!layer->active()); - - assert(action->is_ready()); - - canvas_interface()->get_instance()->perform_action(action); -} - -void -CanvasView::popup_param_menu(synfigapp::ValueDesc value_desc, float location, bool bezier) -{ - parammenu.items().clear(); - get_instance()->make_param_menu(¶mmenu,get_canvas(),value_desc,location,bezier); - - parammenu.popup(3,gtk_get_current_event_time()); -} - -void -CanvasView::add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList ¶m_list,synfigapp::Action::Category category)const -{ - get_instance()->add_actions_to_menu(menu, param_list, category); -} - -bool -CanvasView::on_layer_user_click(int button, Gtk::TreeRow /*row*/, LayerTree::ColumnID /*column_id*/) -{ - switch(button) - { - case 3: - { - Gtk::MenuItem* menu = dynamic_cast(App::ui_manager()->get_widget("/menu-main/menu-layer")); - if(menu && menu->get_submenu()) - { - //menu->set_accel_group(App::ui_manager()->get_accel_group()); - //menu->accelerate(*this); - menu->get_submenu()->popup(button,gtk_get_current_event_time()); - } - - #if 0 - bool multiple_selected=true; - - if(layer_tree->get_selection()->count_selected_rows()<=1) - multiple_selected=false; - - // If the clicked row is not selected, then unselect - // everything that isn't selected and select this row - if(multiple_selected && !layer_tree->get_selection()->is_selected(row)) - { - layer_tree->get_selection()->unselect_all(); - layer_tree->get_selection()->select(row); - multiple_selected=false; - } - - if(column_id==COLUMNID_TIME_TRACK) - return false; - - //synfigapp::ValueDesc value_desc(row[layer_param_tree_model.value_desc]); - //ValueNode::Handle value_node(row[layer_param_tree_model.value_node]); - //ValueNode::Handle parent_value_node; - //ValueBase value=row[layer_param_tree_model.value]; - - //if(row.parent()) - //{ - // parent_value_node=(*row.parent())[layer_tree_model.value_node]; - //} - - { - Layer::Handle layer(row[layer_tree_model.layer]); - synfigapp::Action::ParamList param_list; - param_list.add("time",canvas_interface()->get_time()); - param_list.add("canvas",Canvas::Handle(row[layer_tree_model.canvas])); - param_list.add("canvas_interface",canvas_interface()); - if(!multiple_selected) - param_list.add("layer",layer); - else - { - synfigapp::SelectionManager::LayerList layer_list(get_selection_manager()->get_selected_layers()); - synfigapp::SelectionManager::LayerList::iterator iter; - - for(iter=layer_list.begin();iter!=layer_list.end();++iter) - param_list.add("layer",Layer::Handle(*iter)); - } - - parammenu.items().clear(); - - Gtk::Menu *newlayers(manage(new Gtk::Menu())); - // do we need this? the code is all #ifdef'ed out anyway - // newlayers->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), newlayers)); - build_new_layer_menu(*newlayers); - - parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("New Layer"),*newlayers)); - if(!multiple_selected && layer->get_name()=="PasteCanvas") - { - parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Select All Children"), - sigc::bind( - sigc::mem_fun( - *layer_tree, - &studio::LayerTree::select_all_children_layers - ), - layer - ) - )); - } - - add_actions_to_menu(¶mmenu, param_list,synfigapp::Action::CATEGORY_LAYER); - parammenu.popup(button,gtk_get_current_event_time()); - return true; - } -/* - else if(column_id==LayerTree::COLUMNID_TIME_TRACK && value_node && handle::cast_dynamic(value_node)) - { - // Right-click on time track with animated -// trackmenu.popup(0,0); - return true; - } - else - { - if(!multiple_selected) - { - popup_param_menu(value_desc); - return true; - } - else - { -#warning update me! -#if 0 - parammenu.items().clear(); - parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Connect"), - hide_return(sigc::mem_fun(*canvas_interface().get(),&synfigapp::CanvasInterface::connect_selected_layer_params)) - )); - parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Disconnect"), - hide_return(sigc::mem_fun(*canvas_interface().get(),&synfigapp::CanvasInterface::disconnect_selected_layer_params)) - )); - parammenu.popup(0,0); -#endif - } - return true; - } - */ -#endif -} - return true; - break; - - default: - return false; - break; - } -} - -bool -CanvasView::on_children_user_click(int button, Gtk::TreeRow row, ChildrenTree::ColumnID column_id) -{ - switch(button) - { - case 3: - { - if(column_id==COLUMNID_TIME_TRACK) - return false; - if(!(bool)row[children_tree_model.is_canvas]) - { - synfigapp::ValueDesc value_desc=row[children_tree_model.value_desc]; - if (!value_desc) - { - //! \todo fix properly -- what is the child dialog for? - synfig::info("preventing child dialog right-click crash"); - return true; - } - assert(value_desc); - popup_param_menu(value_desc); - return true; - } - } - return true; - break; - - default: - return false; - break; - } -} - -bool -CanvasView::on_keyframe_tree_event(GdkEvent *event) -{ - switch(event->type) - { - case GDK_BUTTON_PRESS: - switch(event->button.button) - { - case 3: - { - //keyframemenu.popup(event->button.button,gtk_get_current_event_time()); - return true; - } - break; - } - break; - case GDK_MOTION_NOTIFY: - break; - case GDK_BUTTON_RELEASE: - break; - default: - break; - } - return false; -} - -void -CanvasView::refresh_time_window() -{ - //THESE SHOULD AUTOMATICALLY BE TAKEN CARE OF - //time_adjustment().set_lower(time_window_adjustment().get_value()); - //time_adjustment().set_upper(time_window_adjustment().get_value()+time_window_adjustment().get_page_size()); - - time_adjustment().set_page_increment(1.0); // One second - time_adjustment().set_page_size(0); - - if(get_canvas()) - time_adjustment().set_step_increment(1.0/get_canvas()->rend_desc().get_frame_rate()); - time_adjustment().changed(); - - //NOTE THIS SHOULD HOOK INTO THE CORRECT SIGNALS... - if(children_tree) - children_tree->queue_draw(); -} - -void -CanvasView::on_time_changed() -{ - Time time(get_time()); - - current_time_widget->set_value(time); - try { - get_canvas()->keyframe_list().find(time); - current_time_widget->modify_text(Gtk::STATE_NORMAL,Gdk::Color("#FF0000")); - }catch(...){ - current_time_widget->modify_text(Gtk::STATE_NORMAL,Gdk::Color("#000000")); - } - - if(get_time() != time_adjustment().get_value()) - { - //Recenters the window, causing it to jump (possibly undesirably... but whatever) - if(time < time_window_adjustment().get_value() || - time > time_window_adjustment().get_value()+time_window_adjustment().get_page_size()) - { - time_window_adjustment().set_value( - time-time_window_adjustment().get_page_size()/2 - ); - } - time_adjustment().set_value(time); - time_adjustment().value_changed(); - - // Shouldn't these trees just hook into - // the time changed signal...? - //YES THEY SHOULD... - if(layer_tree)layer_tree->queue_draw(); - if(children_tree)children_tree->queue_draw(); - } -} - -void -CanvasView::time_zoom_in() -{ - float frame_rate = get_canvas()->rend_desc().get_frame_rate(); - Time min_page_size = 2/frame_rate; - - time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()*0.75); - if (time_window_adjustment().get_page_size() < min_page_size) - time_window_adjustment().set_page_size(min_page_size); - time_window_adjustment().set_page_increment(time_window_adjustment().get_page_size()); - time_window_adjustment().changed(); - - refresh_time_window(); -} - -void -CanvasView::time_zoom_out() -{ - Time length = (get_canvas()->rend_desc().get_time_end() - - get_canvas()->rend_desc().get_time_start()); - - time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()/0.75); - if (time_window_adjustment().get_page_size() > length) - time_window_adjustment().set_page_size(length); - time_window_adjustment().set_page_increment(time_window_adjustment().get_page_size()); - time_window_adjustment().changed(); - - refresh_time_window(); -} - -void -CanvasView::time_was_changed() -{ - synfig::Time time((synfig::Time)(double)time_adjustment().get_value()); - set_time(time); -} - -void -CanvasView::on_edited_value(synfigapp::ValueDesc value_desc,synfig::ValueBase new_value) -{ - canvas_interface()->change_value(value_desc,new_value); -} - -/* -void -CanvasView::on_children_edited_value(const Glib::ustring&path_string,synfig::ValueBase value) -{ - Gtk::TreePath path(path_string); - - const Gtk::TreeRow row = *(children_tree->get_model()->get_iter(path)); - - assert((bool)row[children_tree_model.is_value_node]); - - synfigapp::ValueDesc value_desc=row[children_tree_model.value_desc]; - assert(value_desc); - - on_edited_value(value_desc,value); -} -*/ - -void -CanvasView::on_id_changed() -{ - update_title(); -} - -void -CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode) -{ - // If the animate flag was set in mode... - Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon"); - if(mode&synfigapp::MODE_ANIMATE) - { - Gtk::Image *icon; - icon=manage(new Gtk::Image(Gtk::StockID("gtk-no"),iconsize)); - animatebutton->remove(); - animatebutton->add(*icon); - tooltips.set_tip(*animatebutton,_("In Animate Editing Mode")); - icon->set_padding(0,0); - icon->show(); - } - else - { - Gtk::Image *icon; - icon=manage(new Gtk::Image(Gtk::StockID("gtk-yes"),iconsize)); - animatebutton->remove(); - animatebutton->add(*icon); - tooltips.set_tip(*animatebutton,_("Not in Animate Editing Mode")); - icon->set_padding(0,0); - icon->show(); - } - - if((mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST)) - { - Gtk::Image *icon; - icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_all"),Gtk::ICON_SIZE_BUTTON)); - keyframebutton->remove(); - keyframebutton->add(*icon); - tooltips.set_tip(*keyframebutton,_("All Keyframes Locked")); - icon->set_padding(0,0); - icon->show(); - } - else if((mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST)) - { - Gtk::Image *icon; - icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_future"),Gtk::ICON_SIZE_BUTTON)); - keyframebutton->remove(); - keyframebutton->add(*icon); - tooltips.set_tip(*keyframebutton,_("Future Keyframes Locked")); - icon->set_padding(0,0); - icon->show(); - } - else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST)) - { - Gtk::Image *icon; - icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_past"),Gtk::ICON_SIZE_BUTTON)); - keyframebutton->remove(); - keyframebutton->add(*icon); - tooltips.set_tip(*keyframebutton,_("Past Keyframes Locked")); - icon->set_padding(0,0); - icon->show(); - } - else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST)) - { - Gtk::Image *icon; - icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_none"),Gtk::ICON_SIZE_BUTTON)); - keyframebutton->remove(); - keyframebutton->add(*icon); - tooltips.set_tip(*keyframebutton,_("No Keyframes Locked")); - icon->set_padding(0,0); - icon->show(); - } - - work_area->queue_draw(); -} - -void -CanvasView::on_animate_button_pressed() -{ - if(get_mode()&synfigapp::MODE_ANIMATE) - set_mode(get_mode()-synfigapp::MODE_ANIMATE); - else - set_mode(get_mode()|synfigapp::MODE_ANIMATE); -} - -void -CanvasView::on_keyframe_button_pressed() -{ - synfigapp::CanvasInterface::Mode mode(get_mode()); - - // future && past --> past - if((mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST)) - set_mode(get_mode()-synfigapp::MODE_ANIMATE_FUTURE); - // past --> future - else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST)) - set_mode((get_mode()-synfigapp::MODE_ANIMATE_PAST)|synfigapp::MODE_ANIMATE_FUTURE); - // future --> (nothing) - else if((mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST)) - set_mode(get_mode()-synfigapp::MODE_ANIMATE_FUTURE); - // (nothing) --> future && past - else if(!(mode&synfigapp::MODE_ANIMATE_FUTURE) && !(mode&synfigapp::MODE_ANIMATE_PAST)) - set_mode(get_mode()|synfigapp::MODE_ANIMATE_FUTURE|synfigapp::MODE_ANIMATE_PAST); -} - -bool -CanvasView::duck_change_param(const synfig::Point &value,synfig::Layer::Handle layer, synfig::String param_name) -{ - return canvas_interface()->change_value(synfigapp::ValueDesc(layer,param_name),value); -} - -bool -CanvasView::on_duck_changed(const synfig::Point &value,const synfigapp::ValueDesc& value_desc) -{ - if (ValueNode_BLineCalcWidth::Handle bline_width = ValueNode_BLineCalcWidth::Handle::cast_dynamic(value_desc.get_value_node())) - { - Real old_width((*bline_width)(get_time()).get(Real())); - Real new_width(value.mag()); - int scale_index(bline_width->get_link_index_from_name("scale")); - Real scale((*(bline_width->get_link(scale_index)))(get_time()).get(Real())); - return canvas_interface()->change_value(synfigapp::ValueDesc(bline_width,scale_index), new_width * scale / old_width); - } - - if (ValueNode_BLineCalcVertex::Handle bline_vertex = ValueNode_BLineCalcVertex::Handle::cast_dynamic(value_desc.get_value_node())) - { - ValueNode_BLine::Handle bline = ValueNode_BLine::Handle::cast_dynamic(bline_vertex->get_link("bline")); - Real radius = 0.0; - if (((*(bline_vertex->get_link("loop")))(get_time()).get(bool()))){ - Real amount_old((*(bline_vertex->get_link("amount")))(get_time()).get(Real())); - Real amount_new = synfig::find_closest_point((*bline)(get_time()), value, radius, bline->get_loop()); - Real difference = fmod( fmod(amount_new - amount_old, 1.0) + 1.0 , 1.0); - //fmod is called twice to avoid negative values - if (difference > 0.5) difference=difference-1.0; - return canvas_interface()->change_value(synfigapp::ValueDesc(bline_vertex,bline_vertex->get_link_index_from_name("amount")), amount_old+difference); - - } else { - Real amount = synfig::find_closest_point((*bline)(get_time()), value, radius, bline->get_loop()); - return canvas_interface()->change_value(synfigapp::ValueDesc(bline_vertex,bline_vertex->get_link_index_from_name("amount")), amount); - } - } - - if (ValueNode_BLineCalcTangent::Handle bline_tangent = ValueNode_BLineCalcTangent::Handle::cast_dynamic(value_desc.get_value_node())) - { - switch(value_desc.get_value_type()) - { - case ValueBase::TYPE_REAL: - { - Real old_length = (*bline_tangent)(get_time()).get(Real()); - Real new_length = value.mag(); - int scale_index(bline_tangent->get_link_index_from_name("scale")); - int fixed_length_index(bline_tangent->get_link_index_from_name("fixed_length")); - Real scale((*(bline_tangent->get_link(scale_index)))(get_time()).get(Real())); - bool fixed_length((*(bline_tangent->get_link(fixed_length_index)))(get_time()).get(bool())); - if (fixed_length) - return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length); - if (old_length == 0) - return true; - return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length * scale / old_length); - } - - case ValueBase::TYPE_ANGLE: - assert(0); // doesn't happen? - break; - - case ValueBase::TYPE_VECTOR: - { - Vector old_tangent = (*bline_tangent)(get_time()).get(Vector()); - Angle old_angle = old_tangent.angle(); - Real old_length = old_tangent.mag(); - Angle new_angle = value.angle(); - Real new_length = value.mag(); - int offset_index(bline_tangent->get_link_index_from_name("offset")); - int scale_index(bline_tangent->get_link_index_from_name("scale")); - int fixed_length_index(bline_tangent->get_link_index_from_name("fixed_length")); - Angle old_offset((*(bline_tangent->get_link(offset_index)))(get_time()).get(Angle())); - Real scale((*(bline_tangent->get_link(scale_index)))(get_time()).get(Real())); - bool fixed_length((*(bline_tangent->get_link(fixed_length_index)))(get_time()).get(bool())); - if (fixed_length) - { - if (!(canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length))) - return false; - } - else if (old_length != 0 && !(canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,scale_index), new_length * scale / old_length))) - return false; - return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,offset_index), old_offset + new_angle - old_angle); - } - default: - break; - } - } - - if (ValueNode_Scale::Handle scale_value_node = ValueNode_Scale::Handle::cast_dynamic(value_desc.get_value_node())) - { - int link_index(scale_value_node->get_link_index_from_name("link")); - if(scale_value_node->is_invertible(get_time())) - return canvas_interface()->change_value( - synfigapp::ValueDesc(scale_value_node,link_index), - scale_value_node->get_inverse(get_time(), value) - ); - else - return false; - } - - if (ValueNode_Range::Handle range_value_node = ValueNode_Range::Handle::cast_dynamic(value_desc.get_value_node())) - { - int link_index(range_value_node->get_link_index_from_name("link")); - return canvas_interface()->change_value( - synfigapp::ValueDesc(range_value_node,link_index), - range_value_node->get_inverse(get_time(), value) - ); - } - - switch(value_desc.get_value_type()) - { - case ValueBase::TYPE_REAL: - return canvas_interface()->change_value(value_desc,value.mag()); - case ValueBase::TYPE_ANGLE: - return canvas_interface()->change_value(value_desc,Angle::tan(value[1],value[0])); - default: - return canvas_interface()->change_value(value_desc,value); - } -} - -bool -CanvasView::on_duck_angle_changed(const synfig::Angle &rotation,const synfigapp::ValueDesc& value_desc) -{ - if (ValueNode_BLineCalcTangent::Handle bline_tangent = ValueNode_BLineCalcTangent::Handle::cast_dynamic(value_desc.get_value_node())) - { - int offset_index(bline_tangent->get_link_index_from_name("offset")); - Angle old_offset((*(bline_tangent->get_link(offset_index)))(get_time()).get(Angle())); - return canvas_interface()->change_value(synfigapp::ValueDesc(bline_tangent,offset_index), old_offset + rotation); - } - - if (ValueNode_Scale::Handle scale_value_node = ValueNode_Scale::Handle::cast_dynamic(value_desc.get_value_node())) - { - int link_index(scale_value_node->get_link_index_from_name("link")); - if(scale_value_node->is_invertible(get_time())) - return canvas_interface()->change_value( - synfigapp::ValueDesc(scale_value_node,link_index), - scale_value_node->get_inverse(get_time(), rotation) - ); - else - return false; - - } - if (ValueNode_Range::Handle range_value_node = ValueNode_Range::Handle::cast_dynamic(value_desc.get_value_node())) - { - int link_index(range_value_node->get_link_index_from_name("link")); - return canvas_interface()->change_value( - synfigapp::ValueDesc(range_value_node,link_index), - range_value_node->get_inverse(get_time(), rotation) - ); - } - // \todo will this really always be the case? - assert(value_desc.get_value_type() == ValueBase::TYPE_ANGLE); - return canvas_interface()->change_value(value_desc, value_desc.get_value(get_time()).get(Angle()) + rotation); -} - -void -CanvasView::selected_layer_color_set(synfig::Color color) -{ - synfigapp::SelectionManager::LayerList selected_list(get_selection_manager()->get_selected_layers()); - synfigapp::SelectionManager::LayerList::iterator iter; - - // Create the action group - //synfigapp::PassiveGrouper group(canvas_interface()->get_instance(),_("Set Colors")); - - Layer::Handle layer; - for(iter=selected_list.begin();iter!=selected_list.end();++iter) - { - if(*iter==layer) - continue; - layer=*iter; - on_edited_value(synfigapp::ValueDesc(layer,"color"),color); - } -} - -void -CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, synfig::Canvas::Handle canvas, std::set& selected_list) -{ - int transforms(0); - String layer_name; - -#define QUEUE_REBUILD_DUCKS sigc::mem_fun(*this,&CanvasView::queue_rebuild_ducks) - - if(!canvas) - { - synfig::warning("CanvasView::rebuild_ducks_layer_(): Layer doesn't have canvas set"); - return; - } - for(Canvas::iterator iter(canvas->begin());iter!=canvas->end();++iter) - { - Layer::Handle layer(*iter); - - if(selected_list.count(layer)) - { - if(!curr_transform_stack_set) - { - curr_transform_stack_set=true; - curr_transform_stack=transform_stack; - } - - // This layer is currently selected. - duck_changed_connections.push_back(layer->signal_changed().connect(QUEUE_REBUILD_DUCKS)); - - // do the bounding box thing - bbox|=transform_stack.perform(layer->get_bounding_rect()); - - // Grab the layer's list of parameters - Layer::ParamList paramlist(layer->get_param_list()); - - // Grab the layer vocabulary - Layer::Vocab vocab=layer->get_param_vocab(); - Layer::Vocab::iterator iter; - - for(iter=vocab.begin();iter!=vocab.end();iter++) - { - if(!iter->get_hidden() && !iter->get_invisible_duck()) - { - synfigapp::ValueDesc value_desc(layer,iter->get_name()); - work_area->add_to_ducks(value_desc,this,transform_stack,&*iter); - if(value_desc.is_value_node()) - duck_changed_connections.push_back(value_desc.get_value_node()->signal_changed().connect(QUEUE_REBUILD_DUCKS)); - } - if(iter->get_name()=="color") - { - /* - if(!App::dialog_color->busy()) - { - App::dialog_color->reset(); - App::dialog_color->set_color(layer->get_param("color").get(Color())); - App::dialog_color->signal_edited().connect( - sigc::mem_fun( - *this, - &studio::CanvasView::selected_layer_color_set - ) - ); - } - */ - } - } - } - - layer_name=layer->get_name(); - - if(layer->active()) - { - Transform::Handle trans(layer->get_transform()); - if(trans) - { - transform_stack.push(trans); - transforms++; - } - -/* // Add transforms onto the stack - if(layer_name=="Translate") - { - transform_stack.push(synfig::Transform_Translate(layer->get_param("origin").get(Vector()))); - transforms++; - }else - if(layer_name=="Zoom") - { - Vector scale; - scale[0]=scale[1]=exp(layer->get_param("amount").get(Real())); - transform_stack.push(synfig::Transform_Scale(scale,layer->get_param("center").get(Vector()))); - transforms++; - }else - if(layer_name=="stretch") - { - Vector scale(layer->get_param("amount").get(Vector())); - transform_stack.push(synfig::Transform_Scale(scale,layer->get_param("center").get(Vector()))); - transforms++; - }else - if(layer_name=="Rotate") - { - transform_stack.push(synfig::Transform_Rotate(layer->get_param("amount").get(Angle()),layer->get_param("origin").get(Vector()))); - transforms++; - } -*/ - } - - // If this is a paste canvas layer, then we need to - // descend into it - if(layer_name=="PasteCanvas") - { - Vector scale; - scale[0]=scale[1]=exp(layer->get_param("zoom").get(Real())); - Vector origin(layer->get_param("origin").get(Vector())); - - Canvas::Handle child_canvas(layer->get_param("canvas").get(Canvas::Handle())); - Vector focus(layer->get_param("focus").get(Vector())); - - if(!scale.is_equal_to(Vector(1,1))) - transform_stack.push(new Transform_Scale(layer->get_guid(), scale,origin+focus)); - if(!origin.is_equal_to(Vector(0,0))) - transform_stack.push(new Transform_Translate(layer->get_guid(), origin)); - - rebuild_ducks_layer_(transform_stack,child_canvas,selected_list); - - if(!origin.is_equal_to(Vector(0,0))) - transform_stack.pop(); - if(!scale.is_equal_to(Vector(1,1))) - transform_stack.pop(); - } - } - // Remove all of the transforms we have added - while(transforms--) { transform_stack.pop(); } - -#undef QUEUE_REBUILD_DUCKS -} - -void -CanvasView::queue_rebuild_ducks() -{ -#if 0 - if(rebuild_ducks_queued) - return; -#else - if(rebuild_ducks_queued) - queue_rebuild_ducks_connection.disconnect(); -#endif - - queue_rebuild_ducks_connection=Glib::signal_timeout().connect( - sigc::bind_return( - sigc::mem_fun(*this,&CanvasView::rebuild_ducks), - false - ), - 50 - ); - - rebuild_ducks_queued=true; -} - -void -CanvasView::rebuild_ducks() -{ - /*static int i=0; - i++; - if(i>30) - synfig::info("%d",i/(i-i)); - */ - - rebuild_ducks_queued=false; - //queue_rebuild_ducks_connection.disconnect(); - - if(work_area->is_dragging()) - { - queue_rebuild_ducks(); - return; - } - - if(!duck_refresh_flag) - { - duck_refresh_needed=true; - return; - } - - bbox=Rect::zero(); - - work_area->clear_ducks(); - work_area->set_time(get_time()); - get_canvas()->set_time(get_time()); - curr_transform_stack.clear(); - //curr_transform_stack.push(new Transform_Translate(Point(0,0))); - curr_transform_stack_set=false; - - for(;!duck_changed_connections.empty();duck_changed_connections.pop_back())duck_changed_connections.back().disconnect(); - - //get_canvas()->set_time(get_time()); - bool not_empty(false); - - // First do the layers... - do{ - synfigapp::SelectionManager::LayerList selected_list(get_selection_manager()->get_selected_layers()); - std::set layer_set(selected_list.begin(),selected_list.end()); - - if(!layer_set.empty()) - not_empty=true; - - synfig::TransformStack transform_stack; - - rebuild_ducks_layer_(transform_stack, get_canvas(), layer_set); - - }while(0); - - // Now do the children - do{ - synfigapp::SelectionManager::ChildrenList selected_list(get_selection_manager()->get_selected_children()); - synfigapp::SelectionManager::ChildrenList::iterator iter; - synfig::TransformStack transform_stack; - - if(selected_list.empty()) - { - break; - } - else - { - not_empty=true; - for(iter=selected_list.begin();iter!=selected_list.end();++iter) - { - work_area->add_to_ducks(*iter,this,transform_stack); - } - } - }while(0); - work_area->refresh_selected_ducks(); - work_area->queue_draw_preview(); -} - -void -CanvasView::decrease_low_res_pixel_size() -{ - if(changing_resolution_) - return; - changing_resolution_=true; - list sizes = CanvasView::get_pixel_sizes(); - int pixel_size = work_area->get_low_res_pixel_size(); - for (list::iterator iter = sizes.begin(); iter != sizes.end(); iter++) - if (*iter == pixel_size) - { - if (iter == sizes.begin()) - // we already have the smallest low-res pixels possible - turn off low-res instead - work_area->set_low_resolution_flag(false); - else - { - iter--; - Glib::RefPtr action = action_group->get_action(strprintf("lowres-pixel-%d", *iter)); - action->activate(); // to make sure the radiobutton in the menu is updated too - work_area->set_low_resolution_flag(true); - } - break; - } - // Update the "toggle-low-res" action - Glib::RefPtr action = Glib::RefPtr::cast_dynamic(action_group->get_action("toggle-low-res")); - action->set_active(work_area->get_low_resolution_flag()); - // Update toggle low res button - resolutiondial->update_lowres(work_area->get_low_resolution_flag()); - changing_resolution_=false; -} - -void -CanvasView::increase_low_res_pixel_size() -{ - if(changing_resolution_) - return; - changing_resolution_=true; - list sizes = CanvasView::get_pixel_sizes(); - int pixel_size = work_area->get_low_res_pixel_size(); - if (!work_area->get_low_resolution_flag()) - { - // We were using "hi res" so change it to low res. - work_area->set_low_resolution_flag(true); - // Update the "toggle-low-res" action - Glib::RefPtr action = Glib::RefPtr::cast_dynamic(action_group->get_action("toggle-low-res")); - action->set_active(true); - // Update the toggle low res button - resolutiondial->update_lowres(true); - changing_resolution_=false; - return; - } - - for (list::iterator iter = sizes.begin(); iter != sizes.end(); iter++) - if (*iter == pixel_size) - { - iter++; - if (iter != sizes.end()) - { - Glib::RefPtr action = action_group->get_action(strprintf("lowres-pixel-%d", *iter)); - action->activate(); // to make sure the radiobutton in the menu is updated too - work_area->set_low_resolution_flag(true); - } - break; - } - // Update the "toggle-low-res" action - Glib::RefPtr action = Glib::RefPtr::cast_dynamic(action_group->get_action("toggle-low-res")); - action->set_active(work_area->get_low_resolution_flag()); - // Update toggle low res button - resolutiondial->update_lowres(work_area->get_low_resolution_flag()); - changing_resolution_=false; -} - -void -CanvasView::toggle_low_res_pixel_flag() -{ - if(changing_resolution_) - return; - changing_resolution_=true; - work_area->toggle_low_resolution_flag(); - // Update the toggle low res button - resolutiondial->update_lowres(work_area->get_low_resolution_flag()); - // Update the "toggle-low-res" action - Glib::RefPtr action = Glib::RefPtr::cast_dynamic(action_group->get_action("toggle-low-res")); - action->set_active(work_area->get_low_resolution_flag()); - changing_resolution_=false; -} - -void -CanvasView::update_quality() -{ - //if(working_depth) - // return; - if(updating_quality_) - return; - updating_quality_=true; - work_area->set_quality((int) quality_spin->get_value()); - // Update Quality Radio actions - Glib::RefPtr action=Glib::RefPtr::cast_dynamic( - action_group->get_action(strprintf("quality-%02d",(int) quality_spin->get_value())) - ); - action->set_active(); - - updating_quality_=false; -} - -void -CanvasView::set_quality(int x) -{ - if(updating_quality_) - return; - work_area->set_quality(x); - // Update the quality spin button - quality_spin->set_value(x); -} - -void -CanvasView::set_onion_skins() -{ - if(toggling_onion_skin) - return; - int onion_skins[2]; - onion_skins[0]=past_onion_spin->get_value(); - onion_skins[1]=future_onion_spin->get_value(); - work_area->set_onion_skins(onion_skins); -} - -void -CanvasView::toggle_show_grid() -{ - if(toggling_show_grid) - return; - toggling_show_grid=true; - work_area->toggle_grid(); - // Update the toggle grid show action - set_grid_show_toggle(work_area->grid_status()); - // Update the toggle grid show check button - show_grid->set_active(work_area->grid_status()); - toggling_show_grid=false; -} - -void -CanvasView::toggle_snap_grid() -{ - if(toggling_snap_grid) - return; - toggling_snap_grid=true; - work_area->toggle_grid_snap(); - // Update the toggle grid snap action - set_grid_snap_toggle(work_area->get_grid_snap()); - // Update the toggle grid snap check button - snap_grid->set_active(work_area->get_grid_snap()); - toggling_snap_grid=false; -} - -void -CanvasView::toggle_onion_skin() -{ - if(toggling_onion_skin) - return; - toggling_onion_skin=true; - work_area->toggle_onion_skin(); - // Update the toggle onion skin action - Glib::RefPtr action = Glib::RefPtr::cast_dynamic(action_group->get_action("toggle-onion-skin")); - action->set_active(work_area->get_onion_skin()); - // Update the toggle grid snap check button - onion_skin->set_active(work_area->get_onion_skin()); - toggling_onion_skin=false; -} - -void -CanvasView::on_dirty_preview() -{ - if(!is_playing_) - { - IsWorking is_working(*this); - - work_area->queue_render_preview(); - } -} - -void -CanvasView::play() -{ - assert(get_canvas()); - - // If we are already busy, don't play! - if(working_depth)return; - - // Set us up as working - IsWorking is_working(*this); - - etl::clock timer; - Time - time=work_area->get_time(), - endtime=get_canvas()->rend_desc().get_time_end(); - - // If we are already at the end of time, start over - if(time==endtime) - time=get_canvas()->rend_desc().get_time_start(); - - is_playing_=true; - - work_area->clear_ducks(); - - for(timer.reset(); time + timer() < endtime;) - { - //Clamp the time window so we can see the time value as it races across the horizon - bool timewindreset = false; - - while( time + timer() > Time(time_window_adjustment().get_sub_upper()) ) - { - time_window_adjustment().set_value( - min( - time_window_adjustment().get_value()+time_window_adjustment().get_page_size()/2, - time_window_adjustment().get_upper()-time_window_adjustment().get_page_size() ) - ); - timewindreset = true; - } - - while( time + timer() < Time(time_window_adjustment().get_sub_lower()) ) - { - time_window_adjustment().set_value( - max( - time_window_adjustment().get_value()-time_window_adjustment().get_page_size()/2, - time_window_adjustment().get_lower()) - ); - - timewindreset = true; - } - - //we need to tell people that the value changed - if(timewindreset) time_window_adjustment().value_changed(); - - //update actual time to next step - time_adjustment().set_value(time+timer()); - time_adjustment().value_changed(); - - if(!work_area->sync_render_preview()) - break; - - // wait for the workarea to refresh itself - while (studio::App::events_pending()) - studio::App::iteration(false); - - if(get_cancel_status()) - { - is_playing_=false; - return; - } - } - on_play_stop_pressed(); - is_playing_=false; - time_adjustment().set_value(endtime); - time_adjustment().value_changed(); -} - -void -CanvasView::show_tables() -{ -/* - Smach::event_result x(process_event_key(EVENT_TABLES_SHOW)); - if(x==Smach::RESULT_OK || x==Smach::RESULT_ACCEPT) - { - Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon"); - treetogglebutton->remove(); - treetogglebutton->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-down"),iconsize))); - treetogglebutton->show_all(); - notebook->show(); - } -*/ -} - -void -CanvasView::hide_tables() -{ -/* - Smach::event_result x(process_event_key(EVENT_TABLES_HIDE)); - if(x==Smach::RESULT_OK || x==Smach::RESULT_ACCEPT) - { - Gtk::IconSize iconsize=Gtk::IconSize::from_name("synfig-small_icon"); - treetogglebutton->remove(); - treetogglebutton->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-up"),iconsize))); - treetogglebutton->show_all(); - notebook->hide(); - } -*/ -} - -bool -CanvasView::tables_are_visible() -{ -// return notebook->is_visible(); - return false; -} - -void -CanvasView::toggle_tables() -{ -// if(tables_are_visible()) -// hide_tables(); -// else -// show_tables(); -} - -void -CanvasView::show_timebar() -{ - timebar->show(); - //current_time_widget->show(); // not needed now that belongs to the timebar - - //keyframe_tab_child->show(); - if(layer_tree) - layer_tree->set_show_timetrack(true); - if(children_tree) - children_tree->set_show_timetrack(true); -} - -void -CanvasView::hide_timebar() -{ - timebar->hide(); - //current_time_widget->hide(); // not needed now that belongs to the timebar - //keyframe_tab_child->hide(); - if(layer_tree) - layer_tree->set_show_timetrack(false); - if(children_tree) - children_tree->set_show_timetrack(false); -} - -void -CanvasView::set_sensitive_timebar(bool sensitive) -{ - timebar->set_sensitive(sensitive); - //current_time_widget->set_sensitive(sensitive); //not needed now that belongs to timebar - //keyframe_tab_child->set_sensitive(sensitive); - if(layer_tree) - layer_tree->set_sensitive(sensitive); - if(children_tree) - children_tree->set_sensitive(sensitive); -} - -static void -set_waypoint_model(std::set > waypoints, - Waypoint::Model model, - etl::loose_handle canvas_interface) -{ - // Create the action group - synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Change Waypoint Group")); - - std::set >::const_iterator iter; - for(iter=waypoints.begin();iter!=waypoints.end();++iter) - { - Waypoint waypoint(*iter); - waypoint.apply_model(model); - - synfigapp::Action::Handle action(synfigapp::Action::create("WaypointSet")); - - assert(action); - - action->set_param("canvas",canvas_interface->get_canvas()); - action->set_param("canvas_interface",canvas_interface); - - action->set_param("waypoint",waypoint); - action->set_param("value_node",waypoint.get_parent_value_node()); - - if(!canvas_interface->get_instance()->perform_action(action)) - { - group.cancel(); - return; - } - } -} - -static void -duplicate_waypoints(std::set > waypoints, - etl::loose_handle canvas_interface) -{ - // Create the action group - synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Duplicate Waypoints")); - - std::set >::const_iterator iter; - for (iter = waypoints.begin(); iter != waypoints.end(); iter++) - { - Waypoint waypoint(*iter); - ValueNode::Handle value_node(iter->get_parent_value_node()); - canvas_interface->waypoint_duplicate(value_node, waypoint); - } -} - -static void -remove_waypoints(std::set > waypoints, - etl::loose_handle canvas_interface) -{ - // Create the action group - synfigapp::Action::PassiveGrouper group(canvas_interface->get_instance().get(),_("Remove Waypoints")); - - std::set >::const_iterator iter; - for (iter = waypoints.begin(); iter != waypoints.end(); iter++) - { - Waypoint waypoint(*iter); - ValueNode::Handle value_node(iter->get_parent_value_node()); - canvas_interface->waypoint_remove(value_node, waypoint); - } -} - -void -CanvasView::on_waypoint_clicked_canvasview(synfigapp::ValueDesc value_desc, - std::set > waypoint_set, - int button) -{ - int size = waypoint_set.size(); - Waypoint waypoint(*(waypoint_set.begin())); - Time time(waypoint.get_time()); - - if (size == 1) - { - waypoint_dialog.set_value_desc(value_desc); - waypoint_dialog.set_waypoint(waypoint); - } - - switch(button) - { - case -1: - if (size == 1) - waypoint_dialog.show(); - break; - case 2: - { - Gtk::Menu* waypoint_menu(manage(new Gtk::Menu())); - waypoint_menu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), waypoint_menu)); - - Gtk::Menu* interp_menu_in(manage(new Gtk::Menu())); - Gtk::Menu* interp_menu_out(manage(new Gtk::Menu())); - Gtk::Menu* interp_menu_both(manage(new Gtk::Menu())); - - { - Waypoint::Model model; - - model.reset(); model.set_before(INTERPOLATION_TCB); - interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - model.reset(); model.set_after(INTERPOLATION_TCB); - interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - model.set_before(INTERPOLATION_TCB); - interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_TCB"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - - model.reset(); model.set_before(INTERPOLATION_LINEAR); - interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - model.reset(); model.set_after(INTERPOLATION_LINEAR); - interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - model.set_before(INTERPOLATION_LINEAR); - interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Linear"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - - model.reset(); model.set_before(INTERPOLATION_HALT); - interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease In"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - model.reset(); model.set_after(INTERPOLATION_HALT); - interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease Out"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - model.set_before(INTERPOLATION_HALT); - interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Ease In/Out"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - - model.reset(); model.set_before(INTERPOLATION_CONSTANT); - interp_menu_in->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - model.reset(); model.set_after(INTERPOLATION_CONSTANT); - interp_menu_out->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - model.set_before(INTERPOLATION_CONSTANT); - interp_menu_both->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Constant"), - sigc::bind(sigc::ptr_fun(set_waypoint_model), waypoint_set, model, canvas_interface()))); - } - - // ------------------------------------------------------------------------ - if (size == 1) - { - const synfigapp::ValueDesc value_desc(synfig::ValueNode_Animated::Handle::cast_reinterpret(waypoint.get_parent_value_node()), time); - get_instance()->make_param_menu(waypoint_menu,canvas_interface()->get_canvas(),value_desc,0.5f); - - // ------------------------------------------------------------------------ - waypoint_menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); - } - - // ------------------------------------------------------------------------ - waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Jump To"), - sigc::bind(sigc::mem_fun(*canvas_interface(), &synfigapp::CanvasInterface::set_time), time))); - - waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Duplicate"), - sigc::bind(sigc::ptr_fun(duplicate_waypoints), waypoint_set, canvas_interface()))); - - waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem((size == 1) ? _("_Remove") : strprintf(_("_Remove %d Waypoints"), size), - sigc::bind(sigc::ptr_fun(remove_waypoints), waypoint_set, canvas_interface()))); - - if (size == 1 && value_desc.is_valid()) - waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Edit"), - sigc::mem_fun(waypoint_dialog,&Gtk::Widget::show))); - - // ------------------------------------------------------------------------ - waypoint_menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem()); - - // ------------------------------------------------------------------------ - waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Both"), *interp_menu_both)); - waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_In"), *interp_menu_in)); - waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Out"), *interp_menu_out)); - - // ------------------------------------------------------------------------ - waypoint_menu->popup(button+1,gtk_get_current_event_time()); - } - break; - - default: - break; - } -} - -void -CanvasView::on_waypoint_changed() -{ - synfigapp::Action::ParamList param_list; - param_list.add("canvas",get_canvas()); - param_list.add("canvas_interface",canvas_interface()); - param_list.add("value_node",waypoint_dialog.get_value_desc().get_value_node()); - param_list.add("waypoint",waypoint_dialog.get_waypoint()); -// param_list.add("time",canvas_interface()->get_time()); - - get_instance()->process_action("WaypointSetSmart", param_list); -} - -void -CanvasView::on_waypoint_delete() -{ - synfigapp::Action::ParamList param_list; - param_list.add("canvas",get_canvas()); - param_list.add("canvas_interface",canvas_interface()); - param_list.add("value_node",waypoint_dialog.get_value_desc().get_value_node()); - param_list.add("waypoint",waypoint_dialog.get_waypoint()); -// param_list.add("time",canvas_interface()->get_time()); - - get_instance()->process_action("WaypointRemove", param_list); -} - -void -CanvasView::on_drop_drag_data_received(const Glib::RefPtr& context, int /*x*/, int /*y*/, const Gtk::SelectionData& selection_data_, guint /*info*/, guint time) -{ - // We will make this true once we have a solid drop - bool success(false); - //synfig::info("Dropped data of type \"%s\"",selection_data.get_data_type()); - //synfig::info("Dropped data of target \"%s\"",gdk_atom_name(selection_data->target)); - //synfig::info("selection=\"%s\"",gdk_atom_name(selection_data->selection)); - - if ((selection_data_.get_length() >= 0) && (selection_data_.get_format() == 8)) - { - if(synfig::String(selection_data_.get_data_type())=="STRING")do - { - synfig::String selection_data((gchar *)(selection_data_.get_data())); - - Layer::Handle layer(synfig::Layer::create("Text")); - if(!layer) - break; - if(!layer->set_param("text",ValueBase(selection_data))) - break; - - synfigapp::Action::Handle action(synfigapp::Action::create("LayerAdd")); - - assert(action); - if(!action) - break; - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",canvas_interface()); - action->set_param("new",layer); - - if(!get_instance()->perform_action(action)) - break; - - // Ok, we have successfully imported at least one item. - success=true; - } while(0); // END of "STRING" - - if(synfig::String(selection_data_.get_data_type())=="text/plain") - { - synfig::String selection_data((gchar *)(selection_data_.get_data())); - - // For some reason, GTK hands us a list of URLs separated - // by not only Carriage-Returns, but also Line-Feeds. - // Line-Feeds will mess us up. Remove all the line-feeds. - while(selection_data.find_first_of('\r')!=synfig::String::npos) - selection_data.erase(selection_data.begin()+selection_data.find_first_of('\r')); - - std::stringstream stream(selection_data); - - //synfigapp::PassiveGrouper group(canvas_interface()->get_instance(),_("Insert Image")); - while(stream) - { - synfig::String filename,URI; - getline(stream,filename); - - // If we don't have a filename, move on. - if(filename.empty()) - continue; - - // Make sure this URL is of the "file://" type. - URI=String(filename.begin(),filename.begin()+sizeof("file://")-1); - if(URI!="file://") - { - synfig::warning("Unknown URI (%s) in \"%s\"",URI.c_str(),filename.c_str()); - continue; - } - - // Strip the "file://" part from the filename - filename=synfig::String(filename.begin()+sizeof("file://")-1,filename.end()); - - String ext(filename_extension(filename)); - if (ext.size()) ext = ext.substr(1); // skip initial '.' - - // If this is a SIF file, then we need to do things slightly differently - if(ext=="sketch") - { - if(work_area->load_sketch(filename)) - { - success=true; - work_area->queue_draw(); - } - } - else - { - String errors, warnings; - if(canvas_interface()->import(filename, errors, warnings, App::resize_imported_images)) - success=true; - if (warnings != "") - App::dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str())); - } - - continue; - } - } // END of "text/plain" - } - else - ui_interface_->error("Drop failed: bad selection data"); - - // Finish the drag - context->drag_finish(success, false, time); -} - -void -CanvasView::on_keyframe_add_pressed() -{ - synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeAdd")); - - if(!action) - { - ui_interface_->error("I am unable to find the appropriate action"); - return; - } - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",canvas_interface()); - action->set_param("keyframe",Keyframe(get_time())); - - canvas_interface()->get_instance()->perform_action(action); -} - -void -CanvasView::on_keyframe_duplicate_pressed() -{ - const KeyframeTreeStore::Model model; - const Gtk::TreeRow row(*keyframe_tree->get_selection()->get_selected()); - Keyframe keyframe; - if(!row) - { - ui_interface_->error("I am unable to duplicate the keyframe"); - return; - } - keyframe=row[model.keyframe]; - - synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeDuplicate")); - - if(!action) - { - ui_interface_->error("I am unable to find the appropriate action"); - return; - } - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",canvas_interface()); - action->set_param("keyframe",keyframe); - action->set_param("time",get_time()); - - canvas_interface()->get_instance()->perform_action(action); -} - -void -CanvasView::on_keyframe_remove_pressed() -{ - const KeyframeTreeStore::Model model; - const Gtk::TreeRow row(*keyframe_tree->get_selection()->get_selected()); - Keyframe keyframe; - if(!row) - { - ui_interface_->error("I am unable to remove the keyframe"); - return; - } - keyframe=row[model.keyframe]; - - synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeRemove")); - - if(!action) - { - ui_interface_->error("I am unable to find the appropriate action"); - return; - } - - action->set_param("canvas",get_canvas()); - action->set_param("canvas_interface",canvas_interface()); - action->set_param("keyframe",keyframe); - - canvas_interface()->get_instance()->perform_action(action); -} - -void -CanvasView::toggle_duck_mask(Duckmatic::Type type) -{ - if(toggling_ducks_) - return; - toggling_ducks_=true; - bool is_currently_on(work_area->get_type_mask()&type); - - if(is_currently_on) - work_area->set_type_mask(work_area->get_type_mask()-type); - else - work_area->set_type_mask(work_area->get_type_mask()|type); - - work_area->queue_draw(); - try - { - // Update the toggle ducks actions - Glib::RefPtr action; - action = Glib::RefPtr::cast_dynamic(action_group->get_action("mask-position-ducks")); - action->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_POSITION)); - action = Glib::RefPtr::cast_dynamic(action_group->get_action("mask-tangent-ducks")); - action->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_TANGENT)); - action = Glib::RefPtr::cast_dynamic(action_group->get_action("mask-vertex-ducks")); - action->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_VERTEX)); - action = Glib::RefPtr::cast_dynamic(action_group->get_action("mask-radius-ducks")); - action->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_RADIUS)); - action = Glib::RefPtr::cast_dynamic(action_group->get_action("mask-width-ducks")); - action->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_WIDTH)); - action = Glib::RefPtr::cast_dynamic(action_group->get_action("mask-angle-ducks")); - action->set_active((bool)(work_area->get_type_mask()&Duck::TYPE_ANGLE)); - // Update toggle ducks buttons - toggleducksdial->update_toggles(work_area->get_type_mask()); - } - catch(...) - { - toggling_ducks_=false; - } - toggling_ducks_=false; -} - -void -CanvasView::image_import() -{ - // String filename(dirname(get_canvas()->get_file_name())); - String filename("*.*"); - String errors, warnings; - if(App::dialog_open_file(_("Import Image"), filename, IMAGE_DIR_PREFERENCE)) - { - canvas_interface()->import(filename, errors, warnings, App::resize_imported_images); - if (warnings != "") - App::dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str())); - } -} - -Smach::event_result -CanvasView::process_event_key(EventKey x) -{ - return smach_.process_event(x); -} - -void -CanvasView::on_input_device_changed(GdkDevice* device) -{ - if(!device) - { - get_smach().egress(); - } - assert(device); - - synfigapp::InputDevice::Handle input_device; - input_device=synfigapp::Main::select_input_device(device->name); - App::toolbox->change_state(input_device->get_state()); - process_event_key(EVENT_INPUT_DEVICE_CHANGED); -} - -void -CanvasView::on_preview_option() -{ - Dialog_PreviewOptions *po = dynamic_cast(get_ext_widget("prevoptions")); - - Canvas::Handle canv = get_canvas(); - - if(canv) - { - RendDesc &r = canv->rend_desc(); - if(r.get_frame_rate()) - { - float rate = 1/r.get_frame_rate(); - float beg = r.get_time_start() + r.get_frame_start()*rate; - float end = r.get_time_start() + r.get_frame_end()*rate; - - if(!po) - { - po = new Dialog_PreviewOptions; - po->set_zoom(work_area->get_zoom()/2); - po->set_fps(r.get_frame_rate()/2); - po->set_begintime(beg); - po->set_begin_override(false); - po->set_endtime(end); - po->set_end_override(false); - - set_ext_widget("prevoptions",po); - } - /*po->set_zoom(work_area->get_zoom()/2); - po->set_fps(r.get_frame_rate()/2); - po->set_begintime(beg); - po->set_begin_override(false); - po->set_endtime(end); - po->set_end_override(false);*/ - - po->set_global_fps(r.get_frame_rate()); - po->signal_finish().connect(sigc::mem_fun(*this,&CanvasView::on_preview_create)); - po->present(); - } - } -} - -void -CanvasView::on_preview_create(const PreviewInfo &info) -{ - //set all the options - etl::handle prev = new Preview; - - prev->set_canvasview(this); - prev->set_zoom(info.zoom); - prev->set_fps(info.fps); - prev->set_overbegin(info.overbegin); - prev->set_begintime(info.begintime); - prev->set_overend(info.overend); - prev->set_endtime(info.endtime); - prev->set_quality(work_area->get_quality()); - - //render it out... - prev->render(); - - Dialog_Preview *pd = preview_dialog.get(); - assert(pd); - - pd->set_default_size(700,510); - pd->set_preview(prev.get()); - pd->present(); -} - -void -CanvasView::on_audio_option() -{ - synfig::warning("Launching Audio Options"); - sound_dialog->set_global_fps(get_canvas()->rend_desc().get_frame_rate()); - sound_dialog->present(); -} - -void -CanvasView::on_audio_file_change(const std::string &f) -{ - //save in meta data - always even when not valid... - canvas_interface()->set_meta_data("audiofile",f); -} - -void -CanvasView::on_audio_offset_change(const synfig::Time &t) -{ - canvas_interface()->set_meta_data("audiooffset",t.get_string()); -} - -void -CanvasView::on_audio_file_notify() -{ - std::string file(get_canvas()->get_meta_data("audiofile")); - if(!file.c_str()) return; - - if(!audio->load(file,dirname(get_canvas()->get_file_name())+string("/"))) - { - if(file != "") synfig::warning("Could not load the file: %s", file.c_str()); - get_canvas()->erase_meta_data("audiofile"); - disp_audio->hide(); - disp_audio->set_profile(etl::handle()); - }else - { - //save in canvasview - synfig::warning("Getting the profile of the music stuff"); - - //profile specific stuff for the preview widget - //similar for other attachments - Dialog_Preview *pd = preview_dialog.get(); - pd->get_widget().set_audio(audio); - - handle prof = audio->get_profile(); - - if(!prof) - { - synfig::warning("Agh, I couldn't build the profile captain!"); - } - pd->get_widget().set_audioprofile(prof); - - disp_audio->set_profile(audio->get_profile()); - disp_audio->show(); - - synfig::warning("successfully set the profiles and stuff"); - } - disp_audio->queue_draw(); -} - -void -CanvasView::on_audio_offset_notify() -{ - Time t(get_canvas()->get_meta_data("audiooffset"),get_canvas()->rend_desc().get_frame_rate()); - audio->set_offset(t); - sound_dialog->set_offset(t); - disp_audio->queue_draw(); - - // synfig::info("CanvasView::on_audio_offset_notify(): offset time set to %s",t.get_string(get_canvas()->rend_desc().get_frame_rate()).c_str()); -} - -void -CanvasView::play_audio(float t) -{ - if(audio.get()) - { - synfig::info("Playing audio at %f s",t); - audio->play(t); - } -} - -void -CanvasView::stop_audio() -{ - if(audio.get()) - { - audio->stop(); - } -} - -bool -CanvasView::on_audio_scrub() -{ - disp_audio->draw(); - return true; -} - -Glib::RefPtr -CanvasView::get_ref_obj(const synfig::String& x) -{ - return ref_obj_book_[x]; -} - -Glib::RefPtr -CanvasView::get_ref_obj(const synfig::String& x)const -{ - return ref_obj_book_.find(x)->second; -} - -void -CanvasView::set_ref_obj(const synfig::String& x, Glib::RefPtr y) -{ - ref_obj_book_[x]=y; -} - -Glib::RefPtr -CanvasView::get_tree_model(const synfig::String& x) -{ - return Glib::RefPtr::cast_dynamic(ref_obj_book_["_tree_model_"+x]); -} - -Glib::RefPtr -CanvasView::get_tree_model(const synfig::String& x)const -{ - return Glib::RefPtr::cast_dynamic(ref_obj_book_.find("_tree_model_"+x)->second); -} - -void -CanvasView::set_tree_model(const synfig::String& x, Glib::RefPtr y) -{ - ref_obj_book_["_tree_model_"+x]=Glib::RefPtr::cast_static(y); -} - -Gtk::Widget* -CanvasView::get_ext_widget(const synfig::String& x) -{ - return ext_widget_book_[x]; -} - -void -CanvasView::set_ext_widget(const synfig::String& x, Gtk::Widget* y) -{ - ext_widget_book_[x]=y; - if(x=="layers_cmp") - { - layer_tree=dynamic_cast(y); - - layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_LAYER_SELECTION_CHANGED)); - layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS)); - layer_tree->signal_layer_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_layer_user_click)); - layer_tree->signal_param_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click)); - layer_tree->signal_waypoint_clicked_layertree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview)); - } - if(x=="children") - { - children_tree=dynamic_cast(y); - if(children_tree)children_tree->signal_user_click().connect(sigc::mem_fun(*this, &studio::CanvasView::on_children_user_click)); - if(children_tree)children_tree->signal_waypoint_clicked_childrentree().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked_canvasview)); - if(children_tree)children_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS)); - } - if(x=="keyframes") - keyframe_tree=dynamic_cast(y); -} - -bool -CanvasView::on_delete_event(GdkEventAny* event __attribute__ ((unused))) -{ - close_view(); - - //! \todo This causes the window to be deleted straight away - but what if we prompt 'save?' and the user cancels? - // Is there ever any need to pass on the delete event to the window here? - // if(event) return Gtk::Window::on_delete_event(event); - - return true; -} - -//! Modify the play stop button apearence and play stop the animation -void -CanvasView::on_play_stop_pressed() -{ - Gtk::Image *icon; - Gtk::Button *stop_button; - stop_button=framedial->get_play_button(); - bool play_flag; - if(!is_playing()) - { - icon = manage(new Gtk::Image(Gtk::Stock::MEDIA_STOP, Gtk::IconSize::from_name("synfig-small_icon"))); - stop_button->set_relief(Gtk::RELIEF_NORMAL); - play_flag=true; - } - else - { - icon = manage(new Gtk::Image(Gtk::Stock::MEDIA_PLAY, Gtk::IconSize::from_name("synfig-small_icon"))); - stop_button->set_relief(Gtk::RELIEF_NONE); - play_flag=false; - } - stop_button->remove(); - stop_button->add(*icon); - icon->set_padding(0, 0); - icon->show(); - if(play_flag) play(); else stop(); -} diff --git a/synfig-studio/src/gtkmm/canvasview.h b/synfig-studio/src/gtkmm/canvasview.h deleted file mode 100644 index 11005d3..0000000 --- a/synfig-studio/src/gtkmm/canvasview.h +++ /dev/null @@ -1,743 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file canvasview.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007, 2008 Chris Moore -** Copyright (c) 2009 Carlos López -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_STUDIO_GTKMM_CANVASVIEW_H -#define __SYNFIG_STUDIO_GTKMM_CANVASVIEW_H - -/* === H E A D E R S ======================================================= */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include "instance.h" -#include "canvasproperties.h" -#include "canvasoptions.h" -#include "render.h" -#include "cellrenderer_timetrack.h" -#include "app.h" - -#include "layertreestore.h" -#include "layertree.h" -#include "childrentreestore.h" -#include "childrentree.h" -#include "keyframetreestore.h" -#include "keyframetree.h" - -#include "dialog_waypoint.h" -#include "dialog_keyframe.h" -#include "framedial.h" -#include "toggleducksdial.h" -#include "resolutiondial.h" -#include "widget_keyframe_list.h" - -#include "duckmatic.h" -#include - -#include - -#include "smach.h" - -#include -#include -#include -#include -#include -#include - -#include "adjust_window.h" - -#include - -/* === M A C R O S ========================================================= */ - -#ifndef DEBUGPOINT_CLASS -#if _DEBUG -#define DEBUGPOINT_CLASS(x) struct debugpointclass_ ## x { debugpointclass_ ## x () { DEBUGPOINT(); } ~debugpointclass_ ## x () { DEBUGPOINT(); } } badfthguae_ ## x ; -#else -#define DEBUGPOINT_CLASS(x) -#endif -#endif - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace synfig { - class TransformStack; -} - -namespace studio { - -class CanvasViewUIInterface; -class CanvasViewSelectionManager; - -class CellRenderer_TimeTrack; -class CellRenderer_ValueBase; -class UniversalScrubber; -class WorkArea; - -class Duckmatic; - -class Preview; -struct PreviewInfo; -class AudioContainer; - -class Widget_Sound; -class Widget_Timeslider; -class Widget_Time; - -class Dialog_SoundSelect; -class Dialog_Preview; - -class Dock_Layers; -class Dock_Children; -class Dock_Keyframes; - -class CanvasView : public Gtk::Window, public etl::shared_object -{ - friend class UniversalScrubber; - friend class Dock_Layers; - friend class Dock_Children; - friend class Dock_Keyframes; - - friend class CanvasViewUIInterface; - friend class CanvasViewSelectionManager; - - friend class Duckmatic; - - /* - -- ** -- P U B L I C T Y P E S --------------------------------------------- - */ - -public: - - typedef etl::handle Handle; - - typedef etl::handle ConstHandle; - - typedef etl::loose_handle LooseHandle; - - typedef LayerTreeStore::Model LayerTreeModel; - - typedef ChildrenTreeStore::Model ChildrenTreeModel; - - //! Create an instance of this class whenever doing a longer task. - /*! Make sure that you check the bool value of this class occasionally - ** to make sure the action has not been canceled. */ - class IsWorking - { - CanvasView &canvas_view_; - - public: - IsWorking(CanvasView &canvas_view_); - ~IsWorking(); - operator bool()const; - }; - friend class IsWorking; - - typedef synfigapp::CanvasInterface::Mode Mode; - - void set_grid_snap_toggle(bool flag) { grid_snap_toggle->set_active(flag); } - void set_grid_show_toggle(bool flag) { grid_show_toggle->set_active(flag); } - - /* - -- ** -- P R I V A T E D A T A --------------------------------------------- - */ - -public: - std::auto_ptr work_area; - - WorkArea* get_work_area() { return work_area.get(); } -private: - - synfig::TransformStack curr_transform_stack; - bool curr_transform_stack_set; - - synfig::Rect bbox; - - // DEBUGPOINT_CLASS(1); - - //! State Machine - Smach smach_; - - // DEBUGPOINT_CLASS(2); - - etl::loose_handle instance_; - etl::handle canvas_interface_; - - // DEBUGPOINT_CLASS(3); - - //! Sound and information to play it - etl::handle audio; - studio::Widget_Sound *disp_audio; //should this be put into thing too? - - sigc::connection playcon; - sigc::connection stopcon; - - std::auto_ptr universal_scrubber; - - //! Tooltip controller - Gtk::Tooltips tooltips; - - // DEBUGPOINT_CLASS(4); - - //! TreeModel for the layers - LayerTreeModel layer_tree_model; - - //! TreeModel for the the children - ChildrenTreeModel children_tree_model; - - //Glib::RefPtr layer_tree_store_; - - //Glib::RefPtr children_tree_store_; - - //Glib::RefPtr keyframe_tree_store_; - - // DEBUGPOINT_CLASS(5); - - //std::map > tree_model_book_; - std::map > ref_obj_book_; - std::map ext_widget_book_; - - //! The time adjustment's scope is defined by the time_window adjustment - Gtk::Adjustment time_adjustment_; - - //! The time_window adjustment governs the position of the time window on the whole time line - //Gtk::Adjustment time_window_adjustment_; - studio::Adjust_Window time_window_adjustment_; - - LayerTree *layer_tree; - - ChildrenTree *children_tree; - - KeyframeTree *keyframe_tree; - - Gtk::Widget *keyframe_tab_child; - - Gtk::ProgressBar *progressbar; - Gtk::Statusbar *statusbar; - - Gtk::TreeRow children_canvas_row; - Gtk::TreeRow children_valuenode_row; - - Gtk::Button *stopbutton; - Gtk::Button *refreshbutton; - Gtk::Button *treetogglebutton; // not used - Gtk::Notebook *notebook; // not used - Gtk::Table *timebar; - Gtk::Table *displaybar; - Gtk::Button *animatebutton; - Gtk::Button *keyframebutton; - FrameDial *framedial; - ToggleDucksDial *toggleducksdial; - bool toggling_ducks_; - ResolutionDial *resolutiondial; - bool changing_resolution_; - Gtk::Adjustment quality_adjustment_; - Gtk::SpinButton *quality_spin; - Gtk::Adjustment future_onion_adjustment_; - Gtk::Adjustment past_onion_adjustment_; - Gtk::SpinButton *past_onion_spin; - Gtk::SpinButton *future_onion_spin; - bool updating_quality_; - Gtk::ToggleButton *show_grid; - Gtk::ToggleButton *snap_grid; - Gtk::ToggleButton *onion_skin; - Gtk::Button *render_options_button; - Gtk::Button *preview_options_button; - bool toggling_show_grid; - bool toggling_snap_grid; - bool toggling_onion_skin; - //! Shows current time and allows edition - Widget_Time *current_time_widget; - void on_current_time_widget_changed(); - - //! Time slider class. Same than the Time track panel - std::auto_ptr timeslider; - - //!Keyframe list slider - std::auto_ptr widget_kf_list; - - std::list duck_changed_connections; - -/* DEBUGPOINT_CLASS(8); - - Gtk::Menu duckmaskmenu; - DEBUGPOINT_CLASS(77); - Gtk::Menu qualitymenu; - DEBUGPOINT_CLASS(6); - - Gtk::Menu filemenu; - DEBUGPOINT_CLASS(777); - Gtk::Menu editmenu; - DEBUGPOINT_CLASS(71); - Gtk::Menu canvasmenu; - DEBUGPOINT_CLASS(73); -public: - Gtk::Menu layermenu; -private: - DEBUGPOINT_CLASS(74); - Gtk::Menu newlayermenu; - DEBUGPOINT_CLASS(76); - Gtk::Menu viewmenu; - - DEBUGPOINT_CLASS(99); - Gtk::Menu keyframemenu; - - Gtk::Menu parammenu; - DEBUGPOINT_CLASS(9); - Gtk::Menu trackmenu; - DEBUGPOINT_CLASS(7); - - Gtk::CheckMenuItem* duck_mask_position; - Gtk::CheckMenuItem* duck_mask_vertex; - Gtk::CheckMenuItem* duck_mask_tangent; - Gtk::CheckMenuItem* duck_mask_radius; - Gtk::CheckMenuItem* duck_mask_width; - Gtk::CheckMenuItem* duck_mask_angle; -*/ - //! Menu members - Gtk::Menu parammenu; - - Glib::RefPtr grid_snap_toggle; - Glib::RefPtr grid_show_toggle; - - Gtk::RadioButtonGroup quality_group; - Gtk::RadioButtonGroup low_res_pixel_size_group; - - Glib::RefPtr action_group; - - etl::handle ui_interface_; - etl::handle selection_manager_; - - bool is_playing_; - - sigc::signal signal_deleted_; - - bool rebuild_ducks_queued; - sigc::connection queue_rebuild_ducks_connection; - - /* - -- ** -- P U B L I C D A T A ----------------------------------------------- - */ - -public: - void queue_rebuild_ducks(); - sigc::signal& signal_deleted() { return signal_deleted_; } - - Gtk::Menu mainmenu; - - bool duck_refresh_flag; - bool duck_refresh_needed; - - //! This is for the IsWorking class. - int working_depth; - - bool cancel; - - /* - -- ** -- D I A L O G S ------------------------------------------------------- - */ - -public: - - CanvasProperties canvas_properties; - CanvasOptions canvas_options; - RenderSettings render_settings; - Dialog_Waypoint waypoint_dialog; - Dialog_Keyframe keyframe_dialog; - - std::auto_ptr preview_dialog; - //std::auto_ptr previewoption_dialog; - std::auto_ptr sound_dialog; - - /* - -- ** -- P R I V A T E M E T H O D S --------------------------------------- - */ - -private: - - // Constructor is private to force the use of the "create()" constructor - CanvasView(etl::loose_handle instance,etl::handle canvas_interface); - - //! Constructor Helper - // Gtk::Widget* create_layer_tree(); - - //! Constructor Helper - // Gtk::Widget* create_children_tree(); - - //! Constructor Helper - // Gtk::Widget* create_keyframe_tree(); - - //! Constructor Helper - Gtk::Widget* create_status_bar(); - - //! Constructor Helper - Initializes all of the menus - void init_menus(); - - bool duck_change_param(const synfig::Point &value,synfig::Layer::Handle layer, synfig::String param_name); - - void refresh_time_window(); - - void time_was_changed(); - - void refresh_rend_desc(); - - void toggle_duck_mask(Duckmatic::Type type); - - Gtk::Widget *create_work_area(); - - Gtk::Widget *create_time_bar(); - - Gtk::Widget *create_display_bar(); - - //! Pop up menu for the bezier (bline, draw) tool (?) - void popup_param_menu_bezier(float location, synfigapp::ValueDesc value_desc) - { popup_param_menu(value_desc,location,true); } - - //! Pop up menu for the tools but not the bezier ones. - void popup_param_menu(synfigapp::ValueDesc value_desc, float location=0, bool bezier=false); - - void workarea_layer_selected(synfig::Layer::Handle layer); - - void selected_layer_color_set(synfig::Color color); - - void register_layer_type(synfig::Layer::Book::value_type &lyr,std::map*); - - //! Rebuilds the "new layer" menu - void build_new_layer_menu(Gtk::Menu &menu); - - void rebuild_ducks_layer_(synfig::TransformStack& transform_stack, synfig::Canvas::Handle canvas, std::set& selected_list); - - void decrease_low_res_pixel_size(); - void increase_low_res_pixel_size(); - void toggle_low_res_pixel_flag(); - void set_quality(int x); - void set_onion_skins(); - void toggle_show_grid(); - void toggle_snap_grid(); - void toggle_onion_skin(); - - /* - -- ** -- P U B L I C M E T H O D S ----------------------------------------- - */ - -public: - const synfig::TransformStack& get_curr_transform_stack()const { return curr_transform_stack; } - - const synfig::Rect& get_bbox()const { return bbox; } - - Glib::RefPtr get_ref_obj(const synfig::String& x); - Glib::RefPtr get_ref_obj(const synfig::String& x)const; - void set_ref_obj(const synfig::String& x, Glib::RefPtr y); - - Glib::RefPtr get_tree_model(const synfig::String& x); - Glib::RefPtr get_tree_model(const synfig::String& x)const; - void set_tree_model(const synfig::String& x, Glib::RefPtr y); - - Gtk::Widget* get_ext_widget(const synfig::String& x); - void set_ext_widget(const synfig::String& x, Gtk::Widget* y); - - //std::map& tree_view_book() { return tree_view_book_; } - //std::map& ext_widget_book() { return tree_view_book_; } - - void popup_main_menu(); - - Smach& get_smach() { return smach_; } - - const Smach& get_smach()const { return smach_; } - - Smach::event_result process_event_key(EventKey x); - - void popup_layer_menu(synfig::Layer::Handle layer); - - virtual ~CanvasView(); - - void set_mode(Mode x) { canvas_interface()->set_mode(x); } - - Mode get_mode()const { return canvas_interface()->get_mode(); } - - Gtk::Adjustment &time_adjustment() { return time_adjustment_; } - - const Gtk::Adjustment &time_adjustment()const { return time_adjustment_; } - - studio::Adjust_Window &time_window_adjustment() { return time_window_adjustment_; } - - const studio::Adjust_Window &time_window_adjustment()const { return time_window_adjustment_; } - - etl::handle get_ui_interface() { return ui_interface_;} - - etl::handle get_selection_manager() { return selection_manager_; } - - Glib::RefPtr layer_tree_store() { return get_tree_model("layers"); } - - Glib::RefPtr layer_tree_store()const { return get_tree_model("layers"); } - - Glib::RefPtr children_tree_store() { return get_tree_model("children"); } - - Glib::RefPtr children_tree_store()const { return get_tree_model("children"); } - - Glib::RefPtr keyframe_tree_store() { return get_tree_model("keyframes"); } - - Glib::RefPtr keyframe_tree_store()const { return get_tree_model("keyframes"); } - - void set_time(synfig::Time t) { canvas_interface_->set_time(t); } - - synfig::Time get_time() { return canvas_interface_->get_time(); } - - etl::handle get_canvas()const { return canvas_interface_->get_canvas(); } - - etl::handle get_instance()const { return instance_; } - - etl::handle canvas_interface() { return canvas_interface_; } - - etl::handle canvas_interface()const { return canvas_interface_; } - - void add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamList ¶m_list, synfigapp::Action::Category category=synfigapp::Action::CATEGORY_ALL)const; - - //! Updates the title of the window - void update_title(); - - //! Closes this document - bool close_instance(); - - //! Closes this canvas view - bool close_view(); - - //! Stops the currently executing action - /*! \see get_cancel_status(), reset_cancel_status(), IsWorking */ - void stop() { cancel=true; } - - //! Returns the cancel status - /*! \see stop(), reset_cancel_status(), IsWorking */ - bool get_cancel_status()const { return cancel; } - - //! Resets the cancel status - /*! \see stop(), get_cancel_status(), IsWorking */ - void reset_cancel_status() { cancel=false; } - - void new_child_canvas(); - - //! Rebuilds layer_tree_store_ from the Canvas. Maintains selected items. - void rebuild_tables(); - - //! Builds layer_tree_store_ from the Canvas. Does not maintain selected items. - void build_tables(); - - //! Refreshes the data for the tables - void refresh_tables(); - - //void rebuild_layer_table(); - //void build_layer_table(); - //void refresh_layer_table(); - -// void rebuild_canvas_table(); -// void build_canvas_table(); -// void refresh_canvas_table(); - -// void rebuild_valuenode_table(); -// void build_valuenode_table(); -// void refresh_valuenode_table(); - - //! \writeme - void rebuild_ducks(); - - //bool add_to_ducks(synfigapp::ValueDesc value_desc, synfig::ParamDesc *param_desc=NULL); - - //! Starts "playing" the animation in real-time - void play(); - - //! Shows the tables (Layer/Children) - void show_tables(); - - //! Hides the tables (Layer/Children) - void hide_tables(); - - //! Toggles the tables - void toggle_tables(); - - //! Gets the table status - bool tables_are_visible(); - - //! Shows the time bar - void show_timebar(); - - //! Hides the time bar - void hide_timebar(); - - //t Enables or disables interaction with the timebar - void set_sensitive_timebar(bool sensitive); - - void time_zoom_in(); - void time_zoom_out(); - - void add_layer(synfig::String x); - - void show_keyframe_dialog(); - - void play_audio(float t); - void stop_audio(); - - void image_import(); - - void on_waypoint_clicked_canvasview(synfigapp::ValueDesc,std::set >, int button); - - void preview_option() {on_preview_option();} - - void present(); - - bool is_playing() { return is_playing_; } - - void update_quality(); - - - - /* - -- ** -- S I G N A L T E R M I N A L S ------------------------------------- - */ - -private: - - void on_select_layers(); - void on_unselect_layers(); - - void on_input_device_changed(GdkDevice*); - - virtual void on_hide(); - - virtual bool on_focus_in_event(GdkEventFocus*); - virtual bool on_focus_out_event(GdkEventFocus*); - - //bool on_children_tree_event(GdkEvent *event); - - bool on_keyframe_tree_event(GdkEvent *event); - - //void on_children_edited_value(const Glib::ustring&path_string,synfig::ValueBase value); - - void on_dirty_preview(); - - bool on_children_user_click(int, Gtk::TreeRow, ChildrenTree::ColumnID); - - bool on_layer_user_click(int, Gtk::TreeRow, LayerTree::ColumnID); - -// void on_layer_toggle(const Glib::ustring& path_string, Gtk::TreeModelColumn column); - - void on_mode_changed(synfigapp::CanvasInterface::Mode mode); - -// void on_layer_waypoint_clicked(const Glib::ustring &, synfig::ValueNode_Animated::WaypointList::iterator); - - //void on_children_waypoint_clicked(const Glib::ustring &, synfig::ValueNode_Animated::WaypointList::iterator); - - void on_waypoint_changed(); - - void on_waypoint_delete(); - - void on_refresh_pressed(); - - void on_id_changed(); - - void on_time_changed(); - - /* - void on_layer_raise_pressed(); - void on_layer_lower_pressed(); - void on_layer_duplicate_pressed(); - void on_layer_delete_pressed(); - */ - - void on_keyframe_add_pressed(); - - void on_keyframe_duplicate_pressed(); - - void on_keyframe_remove_pressed(); - - void on_animate_button_pressed(); - - void on_keyframe_button_pressed(); - - void on_preview_option(); - void on_preview_create(const PreviewInfo &); - - void on_audio_option(); - void on_audio_file_change(const std::string &f); - void on_audio_offset_change(const synfig::Time &t); - - void on_audio_file_notify(); - void on_audio_offset_notify(); - - bool on_duck_changed(const synfig::Point &value,const synfigapp::ValueDesc& value_desc); - bool on_duck_angle_changed(const synfig::Angle &rotation,const synfigapp::ValueDesc& value_desc); - - void on_layer_toggle(synfig::Layer::Handle); - - void on_edited_value(synfigapp::ValueDesc,synfig::ValueBase); - - void on_drop_drag_data_received(const Glib::RefPtr& context, int x, int y, const Gtk::SelectionData& selection_data, guint info, guint time); - - //void on_audio_play(); - bool on_audio_scrub(); - - void on_play_stop_pressed(); - -protected: - bool close_instance_when_safe(); - bool on_delete_event(GdkEventAny* event); - - /* - -- ** -- S T A T I C P U B L I C M E T H O D S --------------------------- - */ - -public: - - static etl::handle create(etl::loose_handle instance,etl::handle canvas); - static std::list& get_pixel_sizes(); - -}; // END of class CanvasView - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/cellrenderer_gradient.cpp b/synfig-studio/src/gtkmm/cellrenderer_gradient.cpp deleted file mode 100644 index 708c362..0000000 --- a/synfig-studio/src/gtkmm/cellrenderer_gradient.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file cellrenderer_gradient.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include "cellrenderer_gradient.h" -#include "widget_gradient.h" -#include "app.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -//using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -CellRenderer_Gradient::CellRenderer_Gradient(): - Glib::ObjectBase (typeid(CellRenderer_Gradient)), - Gtk::CellRendererText (), - property_gradient_(*this,"gradient",synfig::Gradient()) -{ - assert(0); //CHECK: This class does not appear to be used. - //CellRendererText::signal_edited().connect(sigc::mem_fun(*this,&studio::CellRenderer_Gradient::string_edited_)); -} - -CellRenderer_Gradient::~CellRenderer_Gradient() -{ -} - - -void -CellRenderer_Gradient::render_vfunc( - const Glib::RefPtr& window, - Gtk::Widget& /*widget*/, - const Gdk::Rectangle& /*background_area*/, - const Gdk::Rectangle& ca, - const Gdk::Rectangle& /*expose_area*/, - Gtk::CellRendererState /*flags*/) -{ - if(!window) - return; - render_gradient_to_window(window,ca,property_gradient_.get_value()); -} - - -Gtk::CellEditable* -CellRenderer_Gradient::start_editing_vfunc( - GdkEvent* /*event*/, - Gtk::Widget& /*widget*/, - const Glib::ustring& /*path*/, - const Gdk::Rectangle& /*background_area*/, - const Gdk::Rectangle& /*cell_area*/, - Gtk::CellRendererState /*flags*/) -{ - return 0; -} diff --git a/synfig-studio/src/gtkmm/cellrenderer_gradient.h b/synfig-studio/src/gtkmm/cellrenderer_gradient.h deleted file mode 100644 index 10b54c5..0000000 --- a/synfig-studio/src/gtkmm/cellrenderer_gradient.h +++ /dev/null @@ -1,88 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file cellrenderer_gradient.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_STUDIO_CELLRENDERER_GRADIENT_H -#define __SYNFIG_STUDIO_CELLRENDERER_GRADIENT_H - -/* === H E A D E R S ======================================================= */ - -#include -#include - -#include -#include - -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace Gtk { class Entry; class Button; }; - -namespace studio { - -class CellRenderer_Gradient : public Gtk::CellRendererText -{ - sigc::signal signal_secondary_click_; - sigc::signal signal_edited_; - - Glib::Property property_gradient_; - -public: - sigc::signal &signal_edited() - {return signal_edited_; } - - Glib::PropertyProxy property_gradient() { return property_gradient_.get_proxy();} - - CellRenderer_Gradient(); - ~CellRenderer_Gradient(); - -protected: - - virtual void - render_vfunc( - const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& ca, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags); - - virtual Gtk::CellEditable* start_editing_vfunc(GdkEvent* event, - Gtk::Widget& widget, - const Glib::ustring& path, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - Gtk::CellRendererState flags); - -}; // END of class CellRenderer_Gradient - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/cellrenderer_time.cpp b/synfig-studio/src/gtkmm/cellrenderer_time.cpp deleted file mode 100644 index 5567a35..0000000 --- a/synfig-studio/src/gtkmm/cellrenderer_time.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file cellrenderer_time.cpp -** \brief Template File -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2008 Chris Moore -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include "cellrenderer_time.h" -#include "app.h" -#include "widget_time.h" - -#include "general.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -//using namespace etl; -using namespace synfig; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -CellRenderer_Time::CellRenderer_Time(): - Glib::ObjectBase (typeid(CellRenderer_Time)), - Gtk::CellRendererText (), - property_time_(*this,"time",synfig::Time(0)), - property_fps_(*this,"fps", float(0)) -{ - CellRendererText::signal_edited().connect(sigc::mem_fun(*this,&studio::CellRenderer_Time::string_edited_)); -} - -CellRenderer_Time::~CellRenderer_Time() -{ - if (getenv("SYNFIG_DEBUG_DESTRUCTORS")) - synfig::info("CellRenderer_Time::~CellRenderer_Time(): Deleted"); -} - -void -CellRenderer_Time::string_edited_(const Glib::ustring&path,const Glib::ustring&str) -{ - signal_edited_(path,Time((String)str,(Real)Time(property_fps_))); -} - -void -CellRenderer_Time::render_vfunc( - const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& ca, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags) -{ - if(!window) - return; - //int height = ca.get_height(); - - Gtk::StateType state = Gtk::STATE_INSENSITIVE; - if(property_editable()) - state = Gtk::STATE_NORMAL; - if((flags & Gtk::CELL_RENDERER_SELECTED) != 0) - state = (widget.has_focus()) ? Gtk::STATE_SELECTED : Gtk::STATE_ACTIVE; - - const Time time(property_time_); - const float fps((Real)Time(property_fps_)); - - property_text()=(Glib::ustring)time.get_string(fps,App::get_time_format()); - - CellRendererText::render_vfunc(window,widget,background_area,ca,expose_area,flags); -} - - -Gtk::CellEditable* -CellRenderer_Time::start_editing_vfunc( - GdkEvent* event, - Gtk::Widget& widget, - const Glib::ustring& path, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - Gtk::CellRendererState flags) -{ - // If we aren't editable, then there is nothing to do - if(!property_editable()) - return 0; - - const Time time(property_time_); - const float fps((Real)Time(property_fps_)); - - property_text()=(Glib::ustring)time.get_string(fps,App::get_time_format()|Time::FORMAT_FULL); -#if 0 - Widget_Time* widget_time(manage(new Widget_Time)); - widget_time->set_fps(fps); - widget_time->set_value(time); - widget_time->signal_editing_done().connect(sigc::mem_fun(*this, &CellRenderer_Time::on_value_editing_done)); - return widget_time; -#else - return CellRendererText::start_editing_vfunc(event,widget,path,background_area,cell_area,flags); -#endif -} diff --git a/synfig-studio/src/gtkmm/cellrenderer_time.h b/synfig-studio/src/gtkmm/cellrenderer_time.h deleted file mode 100644 index 149f7d8..0000000 --- a/synfig-studio/src/gtkmm/cellrenderer_time.h +++ /dev/null @@ -1,94 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file cellrenderer_time.h -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_STUDIO_CELLRENDERER_TIME_H -#define __SYNFIG_STUDIO_CELLRENDERER_TIME_H - -/* === H E A D E R S ======================================================= */ - -#include -#include - -#include -#include - -#include - -/* === M A C R O S ========================================================= */ - -/* === T Y P E D E F S ===================================================== */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace Gtk { class Entry; class Button; }; - -namespace studio { - -class CellRenderer_Time : public Gtk::CellRendererText -{ - sigc::signal signal_secondary_click_; - sigc::signal signal_edited_; - - Glib::Property property_time_; - Glib::Property property_fps_; - - void string_edited_(const Glib::ustring&,const Glib::ustring&); - - void on_value_editing_done(); - -public: - sigc::signal &signal_edited() - {return signal_edited_; } - - Glib::PropertyProxy property_time() { return property_time_.get_proxy();} - Glib::PropertyProxy property_fps() { return property_fps_.get_proxy();} - - CellRenderer_Time(); - ~CellRenderer_Time(); - -protected: - - virtual void - render_vfunc( - const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& ca, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags); - - virtual Gtk::CellEditable* start_editing_vfunc(GdkEvent* event, - Gtk::Widget& widget, - const Glib::ustring& path, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - Gtk::CellRendererState flags); - -}; // END of class CellRenderer_Time - -}; // END of namespace studio - -/* === E N D =============================================================== */ - -#endif diff --git a/synfig-studio/src/gtkmm/cellrenderer_timetrack.cpp b/synfig-studio/src/gtkmm/cellrenderer_timetrack.cpp deleted file mode 100644 index 8382465..0000000 --- a/synfig-studio/src/gtkmm/cellrenderer_timetrack.cpp +++ /dev/null @@ -1,906 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file cellrenderer_timetrack.cpp -** \brief Template Header -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 2007, 2008 Chris Moore -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "cellrenderer_timetrack.h" -#include -#include -#include -#include -#include "widget_value.h" -#include "app.h" -#include -#include -#include "widget_time.h" -#include "widget_timeslider.h" - -#include -#include "instance.h" - -#include "general.h" - -#endif - -using namespace synfig; -using namespace std; -using namespace etl; -using namespace studio; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -static char stipple_xpm[] = { 2, 0 }; - -//mode for modifier keys -enum MODMODE -{ - NONE = 0, - SELECT_MASK = Gdk::CONTROL_MASK, - COPY_MASK = Gdk::SHIFT_MASK, - DELETE_MASK = Gdk::MOD1_MASK -}; - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -CellRenderer_TimeTrack::CellRenderer_TimeTrack(): - Glib::ObjectBase (typeid(CellRenderer_TimeTrack)), - Gtk::CellRenderer (), - adjustment_ (10,10,20,0,0,0), - - property_valuedesc_ (*this,"value_desc",synfigapp::ValueDesc()), - property_canvas_ (*this,"canvas",synfig::Canvas::Handle()), - property_adjustment_(*this,"adjustment",&adjustment_), - property_enable_timing_info_(*this,"enable-timing-info", false) -{ - dragging=false; - selection=false; -} - -CellRenderer_TimeTrack::~CellRenderer_TimeTrack() -{ - if (getenv("SYNFIG_DEBUG_DESTRUCTORS")) - synfig::info("CellRenderer_TimeTrack::~CellRenderer_TimeTrack(): Deleted"); -} - -void -CellRenderer_TimeTrack::set_adjustment(Gtk::Adjustment &x) -{ - property_adjustment_=&x; -// x.signal_value_changed().connect(sigc::mem_fun(*this,&Gtk::Widget::queue_draw)); -} - -synfig::Canvas::Handle -CellRenderer_TimeTrack::get_canvas()const -{ - return const_cast(this)->property_canvas().get_value(); -} - -Gtk::Adjustment * -CellRenderer_TimeTrack::get_adjustment() -{ - return (Gtk::Adjustment*)property_adjustment_; -} - -const Gtk::Adjustment * -CellRenderer_TimeTrack::get_adjustment()const -{ - return (const Gtk::Adjustment*)property_adjustment_; -} - -bool -CellRenderer_TimeTrack::is_selected(const Waypoint& waypoint)const -{ - return selected==waypoint; -} - -const synfig::Time get_time_offset_from_vdesc(const synfigapp::ValueDesc &v) -{ -#ifdef ADJUST_WAYPOINTS_FOR_TIME_OFFSET - if(getenv("SYNFIG_SHOW_CANVAS_PARAM_WAYPOINTS") || - v.get_value_type() != synfig::ValueBase::TYPE_CANVAS) - return synfig::Time::zero(); - - synfig::Canvas::Handle canvasparam = v.get_value().get(Canvas::Handle()); - if(!canvasparam) - return synfig::Time::zero(); - - if (!v.parent_is_layer_param()) - return synfig::Time::zero(); - - synfig::Layer::Handle layer = v.get_layer(); - - if (layer->get_name()!="PasteCanvas") - return synfig::Time::zero(); - - return layer->get_param("time_offset").get(Time()); -#else // ADJUST_WAYPOINTS_FOR_TIME_OFFSET - return synfig::Time::zero(); -#endif -} - -//kind of a hack... pointer is ugly -const synfig::Node::time_set *get_times_from_vdesc(const synfigapp::ValueDesc &v) -{ - if(!getenv("SYNFIG_SHOW_CANVAS_PARAM_WAYPOINTS") && - v.get_value_type() == synfig::ValueBase::TYPE_CANVAS) - { - synfig::Canvas::Handle canvasparam = v.get_value().get(Canvas::Handle()); - - if(canvasparam) - return &canvasparam->get_times(); - } - - ValueNode *base_value = v.get_value_node().get(); - - ValueNode_DynamicList *parent_value_node = - v.parent_is_value_node() ? - dynamic_cast(v.get_parent_value_node().get()) : - 0; - - //we want a dynamic list entry to override the normal... - if(parent_value_node) - { - return &parent_value_node->list[v.get_index()].get_times(); - }else if(base_value) //don't render stuff if it's just animated... - { - return &base_value->get_times(); - } - return 0; -} - -bool get_closest_time(const synfig::Node::time_set &tset, const Time &t, const Time &range, Time &out) -{ - Node::time_set::const_iterator i,j,end = tset.end(); - - // stop the crash mentioned in bug #1689282 - // doesn't solve the underlying problem though, I don't think - if (tset.size() == 0) - { - synfig::error(__FILE__":%d: tset.size() == 0",__LINE__); - return false; - } - - //TODO add in RangeGet so it's not so damn hard to click on points - - i = tset.upper_bound(t); //where t is the lower bound, t < [first,i) - j = i; --j; - - double dist = Time::end(); - double closest = 0; - - if(i != end) - { - closest = i->get_time(); - dist = abs(i->get_time() - t); - } - - if(j != end && (abs(j->get_time() - t) < dist) ) - { - closest = j->get_time(); - dist = abs(j->get_time() - t); - } - - if( dist <= range/2 ) - { - out = closest; - return true; - } - - return false; -} - -void -CellRenderer_TimeTrack::render_vfunc( - const Glib::RefPtr& window, - Gtk::Widget& widget, - const Gdk::Rectangle& /*background_area*/, - const Gdk::Rectangle& area_, - const Gdk::Rectangle& /*expose_area*/, - Gtk::CellRendererState /*flags*/) -{ - if(!window) - return; - - Glib::RefPtr gc(Gdk::GC::create(window)); - Glib::RefPtr inactive_gc(Gdk::GC::create(window)); - Gtk::Adjustment *adjustment=get_adjustment(); - // Gtk::StateType state = Gtk::STATE_ACTIVE; - // Gtk::ShadowType shadow; - - Gdk::Color - curr_time_color("#0000ff"), - inactive_color("#000000"), - keyframe_color("#a07f7f"); - Gdk::Color activepoint_color[2]; - - activepoint_color[0]=Gdk::Color("#ff0000"); - activepoint_color[1]=Gdk::Color("#00ff00"); - - inactive_gc->set_rgb_fg_color(inactive_color); - inactive_gc->set_stipple(Gdk::Bitmap::create(stipple_xpm,2,2)); - inactive_gc->set_fill(Gdk::STIPPLED); - - synfig::Canvas::Handle canvas(property_canvas().get_value()); - - synfigapp::ValueDesc value_desc = property_value_desc().get_value(); - synfig::ValueNode *base_value = value_desc.get_value_node().get(); - // synfig::ValueNode_Animated *value_node=dynamic_cast(base_value); - - synfig::ValueNode_DynamicList *parent_value_node(0); - if(property_value_desc().get_value().parent_is_value_node()) - parent_value_node=dynamic_cast(property_value_desc().get_value().get_parent_value_node().get()); - - // If the canvas is defined, then load up the keyframes - if(canvas) - { - const synfig::KeyframeList& keyframe_list(canvas->keyframe_list()); - synfig::KeyframeList::const_iterator iter; - - for(iter=keyframe_list.begin();iter!=keyframe_list.end();++iter) - { - if(!iter->get_time().is_valid()) - continue; - - const int x((int)((float)area_.get_width()/(adjustment->get_upper()-adjustment->get_lower())*(iter->get_time()-adjustment->get_lower()))); - if(iter->get_time()>=adjustment->get_lower() && iter->get_time()get_upper()) - { - gc->set_rgb_fg_color(keyframe_color); - window->draw_rectangle(gc, true, area_.get_x()+x, area_.get_y(), 1, area_.get_height()+1); - } - } - } - - //render all the time points that exist - { - const synfig::Node::time_set *tset = get_times_from_vdesc(value_desc); - - if(tset) - { - const synfig::Time time_offset = get_time_offset_from_vdesc(value_desc); - synfig::Node::time_set::const_iterator i = tset->begin(), end = tset->end(); - - float lower = adjustment->get_lower(), - upper = adjustment->get_upper(); - - Glib::RefPtr gc = Gdk::GC::create(widget.get_window()); - - Gdk::Rectangle area(area_); - gc->set_clip_rectangle(area); - gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER); - - bool valselected = sel_value.get_value_node() == base_value && !sel_times.empty(); - - float cfps = get_canvas()->rend_desc().get_frame_rate(); - - vector