From: dooglus Date: Mon, 12 Mar 2007 22:47:51 +0000 (+0000) Subject: Removed trailing whitespace. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c34eaa5441242b3e9a7b7645e9ee4983d14eae85;p=synfig.git Removed trailing whitespace. git-svn-id: http://svn.voria.com/code@305 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/about.cpp b/synfig-studio/trunk/src/gtkmm/about.cpp index eba53e6..7534469 100644 --- a/synfig-studio/trunk/src/gtkmm/about.cpp +++ b/synfig-studio/trunk/src/gtkmm/about.cpp @@ -84,11 +84,11 @@ extern const guint gtk_interface_age; class studio::AboutProgress : public synfig::ProgressCallback { About &about; - + public: AboutProgress(About &about):about(about) { } - + virtual bool task(const std::string &task) { if(about.tasklabel) @@ -170,19 +170,19 @@ About::About(): if(synfig_root) { imagepath=synfig_root; imagepath+=ETL_DIRECTORY_SEPERATOR; - + imagepath+="share/pixmaps"; } imagepath+=ETL_DIRECTORY_SEPERATOR; - - + + // Create the Logo Gtk::Image *Logo = manage(new class Gtk::Image()); Logo->set(imagepath+"about_dialog."IMAGE_EXT); Logo->set_size_request(image_w,image_h); Logo->set_alignment(0.5,0.5); Logo->set_padding(0,0); - + // Create the Copyright Label Gtk::Label *CopyrightLabel = manage(new class Gtk::Label(SYNFIG_COPYRIGHT)); CopyrightLabel->set_size_request(image_w,24); @@ -199,7 +199,7 @@ About::About(): VersionLabel->set_padding(0,0); VersionLabel->set_justify(Gtk::JUSTIFY_CENTER); VersionLabel->set_line_wrap(false); - + // Set the version label to contain the correct information string ver; ver+="Version "VERSION" ("__DATE__" "__TIME__")\n"; @@ -220,7 +220,7 @@ About::About(): Gtk::Image *image2 = manage(new class Gtk::Image(Gtk::StockID("gtk-close"), Gtk::IconSize(4))); image2->set_alignment(0.5,0.5); image2->set_padding(0,0); - + // Create the close button, and attach the image to it CloseButton = manage(new class Gtk::Button()); CloseButton->set_size_request(24,24); @@ -237,7 +237,7 @@ About::About(): tasklabel = manage(new class Gtk::Label()); tasklabel->set_size_request(image_w,24); tasklabel->set_use_underline(false); - + // Create the Gtk::Fixed container and put all of the widgets into it Gtk::Fixed *fixed1 = manage(new class Gtk::Fixed()); fixed1->put(*Logo, 0, 0); @@ -287,7 +287,7 @@ About::set_can_self_destruct(bool x) if(x==true) CloseButton->show(); else - CloseButton->hide(); + CloseButton->hide(); } synfig::ProgressCallback * diff --git a/synfig-studio/trunk/src/gtkmm/about.h b/synfig-studio/trunk/src/gtkmm/about.h index a644bca..434e2a8 100644 --- a/synfig-studio/trunk/src/gtkmm/about.h +++ b/synfig-studio/trunk/src/gtkmm/about.h @@ -44,13 +44,13 @@ namespace synfig { class ProgressCallback; }; namespace studio { class AboutProgress; - + class About : public Gtk::Window { friend class AboutProgress; - + AboutProgress *cb; - + Gtk::Tooltips _tooltips; Gtk::Label *tasklabel; @@ -60,10 +60,10 @@ class About : public Gtk::Window void close(); bool can_self_destruct; - + public: - - synfig::ProgressCallback *get_callback(); + + synfig::ProgressCallback *get_callback(); void set_can_self_destruct(bool x); diff --git a/synfig-studio/trunk/src/gtkmm/adjust_window.cpp b/synfig-studio/trunk/src/gtkmm/adjust_window.cpp index ca0219f..833aa14 100644 --- a/synfig-studio/trunk/src/gtkmm/adjust_window.cpp +++ b/synfig-studio/trunk/src/gtkmm/adjust_window.cpp @@ -81,14 +81,14 @@ const Gtk::Adjustment *Adjust_Window::get_child_adjustment() const 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(); } } @@ -120,23 +120,23 @@ 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; + childchanged = true; } - + if(childchanged) { adj_child->changed(); @@ -147,17 +147,17 @@ void Adjust_Window::update_child() 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); diff --git a/synfig-studio/trunk/src/gtkmm/adjust_window.h b/synfig-studio/trunk/src/gtkmm/adjust_window.h index 2385dd4..3ebd64f 100644 --- a/synfig-studio/trunk/src/gtkmm/adjust_window.h +++ b/synfig-studio/trunk/src/gtkmm/adjust_window.h @@ -38,20 +38,20 @@ 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 @@ -60,18 +60,18 @@ namespace studio { 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, + Adjust_Window(double value, double lower, double upper, double step_increment=1, double page_increment=10, double page_size=0, Gtk::Adjustment *adj = 0); @@ -86,7 +86,7 @@ public: //Sub value interface double get_sub_lower() const; double get_sub_upper() const; }; - + }; // END of namespace studio /* === E N D =============================================================== */ diff --git a/synfig-studio/trunk/src/gtkmm/app.cpp b/synfig-studio/trunk/src/gtkmm/app.cpp index 3fe18a7..205a0bd 100644 --- a/synfig-studio/trunk/src/gtkmm/app.cpp +++ b/synfig-studio/trunk/src/gtkmm/app.cpp @@ -277,11 +277,11 @@ public: ); 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(); @@ -295,12 +295,12 @@ public: ); 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(); @@ -314,11 +314,11 @@ public: ); 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(); @@ -334,7 +334,7 @@ public: virtual bool error(const std::string &err) - { + { Gtk::MessageDialog dialog(err, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true); dialog.show(); dialog.run(); @@ -391,11 +391,11 @@ int v_unwind_key(V_KeyUnwound* unwound, const char* key) int i; unwound->element.serial=0; unwound->element.checksum=0; - + for(i=0;i<16;i++) { U8 data; - + switch(key[i]) { case '0': data=0; break; @@ -428,13 +428,13 @@ int v_key_check(const char* key, U32* serial, U32 appid) V_KeyUnwound unwound_key; U32 appid_mask_a=hash_U32(appid); U32 appid_mask_b=hash_U32(appid_mask_a); - + if(!v_unwind_key(&unwound_key, key)) { // Invalid characters in key return 0; } - + // Undo obfuscation pass { @@ -446,12 +446,12 @@ int v_key_check(const char* key, U32* serial, U32 appid) unwound_key.raw[endian_fix(i)]^=(next>>24); } } - + unwound_key.element.serial^=appid_mask_a; unwound_key.element.checksum^=appid_mask_b; *serial=unwound_key.element.serial; - + return unwound_key.element.checksum==hash_U32(unwound_key.element.serial); } @@ -466,8 +466,8 @@ int check_license(String basedir) license_file="/usr/local/etc/.synfiglicense"; #else license_file=basedir+"\\etc\\.synfiglicense"; -#endif - +#endif + try { key=Glib::file_get_contents(license_file); } catch (Glib::FileError) { } @@ -477,7 +477,7 @@ int check_license(String basedir) while(!v_key_check(key.c_str(),&serial,0xdeadbeef)) { key.clear(); - + if(!App::dialog_entry( _("Synfig Studio Authentication"), _("Please enter your license key below. You will not\nbe able to use this software without a valid license key."), @@ -485,7 +485,7 @@ int check_license(String basedir) )) throw String("No License"); } - + FILE* file=fopen(license_file.c_str(),"w"); if(file) { @@ -499,7 +499,7 @@ int check_license(String basedir) return serial; #else return 1; -#endif +#endif } /* @@ -532,7 +532,7 @@ studio::add_action_group_to_top(Glib::RefPtr ui_manager, Glib DEBUGPOINT(); std::list > prev_groups(ui_manager->get_action_groups()); std::list >::reverse_iterator iter; - + DEBUGPOINT(); for(iter=prev_groups.rbegin();iter!=prev_groups.rend();++iter) { @@ -545,7 +545,7 @@ studio::add_action_group_to_top(Glib::RefPtr ui_manager, Glib } DEBUGPOINT(); ui_manager->insert_action_group(group,0); - + DEBUGPOINT(); for(;!prev_groups.empty();prev_groups.pop_front()) { @@ -595,16 +595,16 @@ public: value=strprintf("%i",App::auto_recover->get_timeout()); 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, @@ -613,7 +613,7 @@ public: ); App::gamma.set_all(r,g,b,blk); - + return true; } if(key=="time_format") @@ -645,10 +645,10 @@ public: App::distance_system=Distance::ident_system(value);; return true; } - + return synfigapp::Settings::set_value(key,value); } - + virtual KeyList get_key_list()const { KeyList ret(synfigapp::Settings::get_key_list()); @@ -672,7 +672,7 @@ init_ui_manager() Glib::RefPtr toolbox_action_group = Gtk::ActionGroup::create("toolbox"); Glib::RefPtr actions_action_group = Gtk::ActionGroup::create(); - + 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") ); @@ -696,7 +696,7 @@ init_ui_manager() iter->second.local_name,iter->second.local_name )); } - + #define DEFINE_ACTION(x,stock) { Glib::RefPtr action( Gtk::Action::create(x, stock) ); /*action->set_sensitive(false);*/ actions_action_group->add(action); } #define DEFINE_ACTION2(x,stock,label) { Glib::RefPtr action( Gtk::Action::create(x, stock,label,label) ); /*action->set_sensitive(false);*/ actions_action_group->add(action); } #define DEFINE_ACTION_SIG(group,x,stock,sig) { Glib::RefPtr action( Gtk::Action::create(x, stock) ); /*action->set_sensitive(false);*/ group->add(action,sig); } @@ -782,11 +782,11 @@ init_ui_manager() // Set up synfigapp actions /*{ synfigapp::Action::Book::iterator iter; - + for(iter=synfigapp::Action::book().begin();iter!=synfigapp::Action::book().end();++iter) { Gtk::StockID stock_id; - + if(!(iter->second.category&synfigapp::Action::CATEGORY_HIDDEN)) { //Gtk::Image* image(manage(new Gtk::Image())); @@ -800,7 +800,7 @@ init_ui_manager() //else if(iter->second.task=="duplicate") stock_id=Gtk::Stock::COPY; else if(iter->second.task=="remove") stock_id=Gtk::Stock::DELETE; else stock_id=Gtk::StockID("synfig-"+iter->second.task); - + actions_action_group->add(Gtk::Action::create( "action-"+iter->second.name, stock_id, @@ -1032,7 +1032,7 @@ init_ui_manager() ACCEL("//state-gradient","g"); ACCEL("//state-zoom","z"); ACCEL("//canvas-zoom-fit","z"); - + #undef ACCEL } @@ -1047,11 +1047,11 @@ App::App(int *argc, char ***argv): IconControler(etl::dirname((*argv)[0])) { app_base_path_=etl::dirname(etl::dirname((*argv)[0])); - + int serial_; serial_=check_license(app_base_path_); - - + + ui_interface_=new GlobalUIInterface(); gdk_rgb_init(); @@ -1059,7 +1059,7 @@ App::App(int *argc, char ***argv): Glib::thread_init(); distance_system=Distance::SYSTEM_UNITS; - + if(mkdir(get_user_app_directory().c_str(),ACCESSPERMS)<0) { if(errno!=EEXIST) @@ -1069,10 +1069,10 @@ App::App(int *argc, char ***argv): { synfig::info("Created directory \"%s\"",get_user_app_directory().c_str()); } - - + + ipc=new IPC(); - + try { if(!SYNFIG_CHECK_VERSION()) @@ -1100,7 +1100,7 @@ App::App(int *argc, char ***argv): throw 39; } Glib::set_application_name(_("SYNFIG Studio")); - + About about_window; about_window.set_can_self_destruct(false); about_window.show(); @@ -1108,7 +1108,7 @@ App::App(int *argc, char ***argv): shutdown_in_progress=false; SuperCallback synfig_init_cb(about_window.get_callback(),0,9000,10000); SuperCallback studio_init_cb(about_window.get_callback(),9000,10000,10000); - + // Initialize the Synfig library try { synfigapp_main=etl::smart_ptr(new synfigapp::Main(etl::dirname((*argv)[0]),&synfig_init_cb)); } catch(...) @@ -1119,13 +1119,13 @@ App::App(int *argc, char ***argv): // 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(); @@ -1166,11 +1166,11 @@ App::App(int *argc, char ***argv): 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); @@ -1186,8 +1186,8 @@ App::App(int *argc, char ***argv): 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(); @@ -1204,21 +1204,21 @@ App::App(int *argc, char ***argv): state_manager->add_state(&state_rotate); state_manager->add_state(&state_bline); - - + + state_manager->add_state(&state_circle); state_manager->add_state(&state_rectangle); state_manager->add_state(&state_gradient); state_manager->add_state(&state_eyedrop); state_manager->add_state(&state_fill); - + state_manager->add_state(&state_zoom); // Disabled this tool because it should be // considered deprecated. Use the bline tool instead. if(getenv("SYNFIG_ENABLE_POLYGON")) state_manager->add_state(&state_polygon); - + // These tools are disabled by default for now, // because they tend to confuse users. if(getenv("SYNFIG_ENABLE_DRAW" )) state_manager->add_state(&state_draw); @@ -1234,7 +1234,7 @@ App::App(int *argc, char ***argv): 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 ) ); @@ -1246,9 +1246,9 @@ App::App(int *argc, char ***argv): studio_init_cb.task("Loading Settings..."); load_settings(); studio_init_cb.task("Checking auto-recover..."); - + studio_init_cb.amount_complete(9900,10000); - + if(auto_recover->recovery_needed()) { about_window.hide(); @@ -1276,7 +1276,7 @@ App::App(int *argc, char ***argv): } about_window.show(); } - + // Look for any files given on the command line, // and load them if found. for(;*argc>=1;(*argc)--) @@ -1287,10 +1287,10 @@ App::App(int *argc, char ***argv): open((*argv)[*argc]); about_window.show(); } - + studio_init_cb.task("Done."); studio_init_cb.amount_complete(10000,10000); - + toolbox->present(); } catch(...) @@ -1308,27 +1308,27 @@ App::~App() 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; toolbox->hide(); -// studio::App::iteration(false); - +// studio::App::iteration(false); + delete toolbox; - -// studio::App::iteration(false); -// studio::App::iteration(false); +// studio::App::iteration(false); + +// studio::App::iteration(false); delete dialog_setup; @@ -1363,18 +1363,18 @@ App::add_recent_file(const std::string &file_name) 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 outselves into one if(!is_absolute_path(filename)) filename=absolute_path(filename); - + list::iterator iter; // Check to see if the file is already on the list. // If it is, then remove it from the list @@ -1385,16 +1385,16 @@ App::add_recent_file(const std::string &file_name) break; } - + // Push the filename to the front of the list recent_files.push_front(filename); - + // Clean out the files at the end of the list. while(recent_files.size()>(unsigned)get_max_recent_files()) recent_files.pop_back(); - + signal_recent_files_changed_(); - + return; } @@ -1429,22 +1429,22 @@ App::save_settings() 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<task("Quit Request"); if(Busy::count) { @@ -1577,18 +1577,18 @@ App::quit() return; } } -*/ - +*/ + // This next line causes things to crash for some reason - //(*iter)->close(); + //(*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(); @@ -1616,7 +1616,7 @@ static OPENFILENAME ofn={}; #ifdef WIN32 #include #endif - + bool App::dialog_open_file(const std::string &title, std::string &filename) { @@ -1626,7 +1626,7 @@ App::dialog_open_file(const std::string &title, std::string &filename) 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; @@ -1646,27 +1646,27 @@ App::dialog_open_file(const std::string &title, std::string &filename) // 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 synfig::String prev_path; if(!_preferences.get_value("curr_path",prev_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::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT); @@ -1681,18 +1681,18 @@ App::dialog_open_file(const std::string &title, std::string &filename) delete dialog; return false; /* - + GtkWidget *ok; GtkWidget *cancel; int val=0; - + GtkWidget *fileselection; fileselection = gtk_file_selection_new(title.c_str()); - + if(basename(filename)==filename) { - gtk_file_selection_set_filename(GTK_FILE_SELECTION(fileselection),(prev_path+ETL_DIRECTORY_SEPERATOR).c_str()); + gtk_file_selection_set_filename(GTK_FILE_SELECTION(fileselection),(prev_path+ETL_DIRECTORY_SEPERATOR).c_str()); } else gtk_file_selection_set_filename(GTK_FILE_SELECTION(fileselection),dirname(filename).c_str()); @@ -1702,15 +1702,15 @@ App::dialog_open_file(const std::string &title, std::string &filename) ok=GTK_FILE_SELECTION(fileselection)->ok_button; cancel=GTK_FILE_SELECTION(fileselection)->cancel_button; - gtk_signal_connect(GTK_OBJECT(ok),"clicked",GTK_SIGNAL_FUNC(Signal_Open_Ok),&val); - gtk_signal_connect(GTK_OBJECT(cancel),"clicked",GTK_SIGNAL_FUNC(Signal_Open_Cancel),&val); + gtk_signal_connect(GTK_OBJECT(ok),"clicked",GTK_SIGNAL_FUNC(Signal_Open_Ok),&val); + gtk_signal_connect(GTK_OBJECT(cancel),"clicked",GTK_SIGNAL_FUNC(Signal_Open_Cancel),&val); gtk_widget_show(fileselection); while(!val) - iteration(); - - + iteration(); + + if(val==1) { filename=gtk_file_selection_get_filename(GTK_FILE_SELECTION(fileselection)); @@ -1732,11 +1732,11 @@ App::dialog_save_file(const std::string &title, std::string &filename) { #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; @@ -1756,15 +1756,15 @@ App::dialog_save_file(const std::string &title, std::string &filename) // 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; @@ -1775,7 +1775,7 @@ App::dialog_save_file(const std::string &title, std::string &filename) synfig::String prev_path; if(!_preferences.get_value("curr_path",prev_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::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT); @@ -1798,11 +1798,11 @@ App::dialog_saveas_file(const std::string &title, std::string &filename) { #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; @@ -1822,15 +1822,15 @@ App::dialog_saveas_file(const std::string &title, std::string &filename) // 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; @@ -1841,7 +1841,7 @@ App::dialog_saveas_file(const std::string &title, std::string &filename) synfig::String prev_path; if(!_preferences.get_value("curr_path",prev_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::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT); @@ -1887,7 +1887,7 @@ App::dialog_yes_no(const std::string &title, const std::string &message) ); 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); @@ -1919,7 +1919,7 @@ 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(); + dialog.run(); } bool @@ -1975,25 +1975,25 @@ App::open_as(std::string filename,std::string as) try { OneMoment one_moment; - + etl::handle canvas(open_canvas_as(filename,as)); if(canvas && get_instance(canvas)) { get_instance(canvas)->find_canvas_view(canvas)->present(); - throw (String)strprintf(_("\"%s\" appears to already be open!"),filename.c_str()); + throw (String)strprintf(_("\"%s\" appears to already be open!"),filename.c_str()); } if(!canvas) throw (String)strprintf(_("Unable to open file \"%s\""),filename.c_str()); add_recent_file(as); - + handle instance(Instance::create(canvas)); if(!instance) throw (String)strprintf(_("Unable to create instance for \"%s\""),filename.c_str()); - + 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(); } @@ -2009,7 +2009,7 @@ App::open_as(std::string filename,std::string as) } _preferences.set_value("curr_path",dirname(as)); - + return true; } @@ -2021,7 +2021,7 @@ App::new_instance() canvas->set_name(strprintf("Untitled%d",Instance::get_count())); String file_name(strprintf("untitled%d.sif",Instance::get_count())); - + canvas->rend_desc().set_frame_rate(24.0); canvas->rend_desc().set_time_start(0.0); canvas->rend_desc().set_time_end(00.0); @@ -2034,7 +2034,7 @@ App::new_instance() canvas->rend_desc().set_antialias(1); canvas->rend_desc().set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN); canvas->set_file_name(file_name); - + Instance::create(canvas)->find_canvas_view(canvas)->canvas_properties.present(); } diff --git a/synfig-studio/trunk/src/gtkmm/app.h b/synfig-studio/trunk/src/gtkmm/app.h index 595a83f..6fe370b 100644 --- a/synfig-studio/trunk/src/gtkmm/app.h +++ b/synfig-studio/trunk/src/gtkmm/app.h @@ -65,7 +65,7 @@ namespace synfigapp }; class Preferences; - + namespace studio { typedef Gtk::UIManager UIManager; @@ -94,17 +94,17 @@ class Dock_Info; class Dock_Navigator; class Dock_LayerGroups; class IPC; - + class Module; class StateManager; class IconControler; - + class App : public Gtk::Main, private IconControler { friend class Preferences; friend class Dialog_Setup; - + /* -- ** -- P U B L I C T Y P E S --------------------------------------------- */ @@ -149,7 +149,7 @@ private: static etl::handle selected_canvas_view; static Glib::RefPtr ui_manager_; - + // static std::list< etl::handle< Module > > module_list_; /* @@ -179,7 +179,7 @@ public: static std::list > instance_list; - static bool shutdown_in_progress; + static bool shutdown_in_progress; static bool use_colorspace_gamma; @@ -285,14 +285,14 @@ public: static void dialog_open(); 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); @@ -301,7 +301,7 @@ public: 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); @@ -317,7 +317,7 @@ public: 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 synfig::String get_user_app_directory(); diff --git a/synfig-studio/trunk/src/gtkmm/asyncrenderer.cpp b/synfig-studio/trunk/src/gtkmm/asyncrenderer.cpp index b2de087..32a6309 100644 --- a/synfig-studio/trunk/src/gtkmm/asyncrenderer.cpp +++ b/synfig-studio/trunk/src/gtkmm/asyncrenderer.cpp @@ -75,7 +75,7 @@ class AsyncTarget_Tile : public synfig::Target_Tile { public: etl::handle warm_target; - + struct tile_t { Surface surface; @@ -88,15 +88,15 @@ public: }; 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) @@ -115,7 +115,7 @@ public: ready_connection=tile_ready_signal.connect(sigc::mem_fun(*this,&AsyncTarget_Tile::tile_ready)); #endif } - + ~AsyncTarget_Tile() { ready_connection.disconnect(); @@ -125,17 +125,17 @@ public: 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); } @@ -145,14 +145,14 @@ public: 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); @@ -174,7 +174,7 @@ public: tile_ready_signal(); #endif } - + return alive_flag; } @@ -190,9 +190,9 @@ public: while(!tile_queue.empty() && alive_flag) { tile_t& tile(tile_queue.front()); - + alive_flag=warm_target->add_tile(tile.surface,tile.x,tile.y); - + tile_queue.pop_front(); } cond_tile_queue_empty.signal(); @@ -224,12 +224,12 @@ 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 @@ -255,7 +255,7 @@ public: #endif surface.set_wh(warm_target->rend_desc().get_w(),warm_target->rend_desc().get_h()); } - + ~AsyncTarget_Scanline() { ready_connection.disconnect(); @@ -274,12 +274,12 @@ public: Glib::Mutex::Lock lock(mutex); alive_flag=false; } - + virtual bool start_frame(synfig::ProgressCallback *cb=0) - { + { return alive_flag; } - + virtual void end_frame() { { @@ -310,14 +310,14 @@ public: } } - + virtual Color * start_scanline(int scanline) { Glib::Mutex::Lock lock(mutex); return surface[scanline]; } - + virtual bool end_scanline() { return alive_flag; @@ -350,9 +350,9 @@ AsyncRenderer::AsyncRenderer(etl::handle target_,synfig::Progres 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_)) @@ -362,9 +362,9 @@ AsyncRenderer::AsyncRenderer(etl::handle target_,synfig::Progres etl::handle::cast_dynamic(target_) ) ); - + signal_stop_.connect(sigc::mem_fun(*wrap_target,&AsyncTarget_Scanline::set_dead)); - + target=wrap_target; } } @@ -381,23 +381,23 @@ AsyncRenderer::stop() { Glib::Mutex::Lock lock(mutex); done_connection.disconnect(); - + if(render_thread) { signal_stop_(); - + #if REJOIN_ON_STOP 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; } @@ -435,7 +435,7 @@ AsyncRenderer::start_() #ifndef GLIB_DISPATCHER_BROKEN done_connection=signal_done_.connect(mem_fun(*this,&AsyncRenderer::stop)); #endif - + render_thread=Glib::Thread::create( sigc::mem_fun(*this,&AsyncRenderer::render_target), #if REJOIN_ON_STOP @@ -456,7 +456,7 @@ void AsyncRenderer::render_target() { etl::handle target(AsyncRenderer::target); - + if(target && target->render()) { success=true; diff --git a/synfig-studio/trunk/src/gtkmm/asyncrenderer.h b/synfig-studio/trunk/src/gtkmm/asyncrenderer.h index 6e040aa..59f96a9 100644 --- a/synfig-studio/trunk/src/gtkmm/asyncrenderer.h +++ b/synfig-studio/trunk/src/gtkmm/asyncrenderer.h @@ -54,16 +54,16 @@ class AsyncRenderer : public etl::shared_object, public sigc::trackable 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; @@ -100,7 +100,7 @@ private: */ protected: - + }; }; // END of namespace studio diff --git a/synfig-studio/trunk/src/gtkmm/audiocontainer.cpp b/synfig-studio/trunk/src/gtkmm/audiocontainer.cpp index a5a9c92..759adc6 100644 --- a/synfig-studio/trunk/src/gtkmm/audiocontainer.cpp +++ b/synfig-studio/trunk/src/gtkmm/audiocontainer.cpp @@ -84,51 +84,51 @@ using studio::AudioContainer; bool build_profile(FSOUND_SAMPLE *sample, double &samplerate, std::vector &samples) { #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 + + //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; @@ -139,27 +139,27 @@ bool build_profile(FSOUND_SAMPLE *sample, double &samplerate, std::vector 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) @@ -171,7 +171,7 @@ bool build_profile(FSOUND_SAMPLE *sample, double &samplerate, std::vector //insert onto new list samples.push_back(maxs); samples.push_back(mins); - + //and flush all the used samples for curaccum curaccum -= 1; } @@ -180,21 +180,21 @@ bool build_profile(FSOUND_SAMPLE *sample, double &samplerate, std::vector //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) @@ -206,31 +206,31 @@ bool build_profile(FSOUND_SAMPLE *sample, double &samplerate, std::vector //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 } @@ -238,7 +238,7 @@ bool build_profile(FSOUND_SAMPLE *sample, double &samplerate, std::vector //FMOD Systemwide Specific data mostly here... struct scrubinfo; - + #ifdef WITH_FMOD static double buffer_length_sec = 0; @@ -256,112 +256,112 @@ static double buffer_length_sec = 0; /* 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 + // 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(); + + 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) { @@ -369,65 +369,65 @@ struct scrubinfo 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 + // WE ARE LOSING A TINY AMOUNT OF PRECISION ACCURACY EVERY UPDATE // (THIS SHOULDN'T BE A PROBLEM) - const double p0 = FSOUND_GetCurrentPosition(channel); + const double p0 = FSOUND_GetCurrentPosition(channel); double curdp = 0; - + if(!FSOUND_GetPaused(channel)) { curdp = FSOUND_GetFrequency(channel) * deltatime; } - //need to rescale derivative... + //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) { @@ -438,11 +438,11 @@ struct scrubinfo FSOUND_SetPaused(channel,false); if(!FSOUND_SetFrequency(channel,freq)) { - //ERROR WILL ROBINSON!!!... + //ERROR WILL ROBINSON!!!... printf("Error in Freq... what do I do?\n"); } } - } + } }; struct scrubuserdata @@ -452,24 +452,24 @@ struct scrubuserdata 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(); + lock.UnLockWrite(); }*/ - + scrubinfo * volatile * scrub; }; @@ -484,20 +484,20 @@ void * scrubdspwrap(void *originalbuffer, void *newbuffer, int length, void *use 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... + + //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 + + //loop through the list and process all the active scrub units std::vector::iterator i = v.begin(), - end = v.end(); + end = v.end(); for(;i != end; ++i) { //check to make sure this object is active... @@ -507,15 +507,15 @@ void * scrubdspwrap(void *originalbuffer, void *newbuffer, int length, void *use } } */ - + if(sd.scrub && *sd.scrub) { //dsp += " processing..."; - scrubinfo * info = (*sd.scrub); + scrubinfo * info = (*sd.scrub); info->scrub_dsp_process(); } } - + //synfig::info(dsp); return newbuffer; @@ -527,63 +527,63 @@ class FMODInitializer { bool loaded; int refcount; - + public: FMODInitializer():loaded(false),refcount(0) {} - ~FMODInitializer() + ~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) @@ -593,20 +593,20 @@ public: { --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) @@ -614,7 +614,7 @@ public: #ifdef WITH_FMOD synfig::info("Unloading FMOD"); if(scrubdspunit) FSOUND_DSP_Free(scrubdspunit); - FSOUND_Close(); + FSOUND_Close(); #endif loaded = false; } @@ -653,48 +653,48 @@ double studio::AudioProfile::get_offset() const //---------- 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.... + //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;} void set_scrubbing(bool s) { #ifdef WITH_FMOD if(s) scrptr = &scrinfo; - else + else #endif scrptr = 0; } - + //helper to make sure we are actually playing (and to get a new channel...) bool init_play() { @@ -717,14 +717,14 @@ struct studio::AudioContainer::AudioImp FSOUND_SetFrequency(channel,sfreq); } return true; - + #else - + return false; - + #endif } - + public: //structors AudioImp() :sample(0), @@ -733,19 +733,19 @@ public: //structors length(0), offset(0), playing(false), - scrptr(0) + 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... { @@ -757,10 +757,10 @@ public: //helper/accessor funcs FSOUND_SetPaused(channel,false); } #endif - + return false; //so the timer doesn't repeat itself - } - + } + bool isRunning() { #ifdef WITH_FMOD @@ -769,26 +769,26 @@ public: //helper/accessor funcs 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) + void set_offset(const double &d) { offset = d; } - + //Will override the parameter timevalue if the sound is running, and not if it's not... bool get_current_time(double &out) { @@ -796,32 +796,32 @@ public: //forward interface { #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; @@ -845,7 +845,7 @@ bool studio::AudioContainer::load(const string &filename,const string &filedirec { imp = new AudioImp; } - + profilevalid = false; return imp->load(filename,filedirectory); } @@ -853,30 +853,30 @@ bool studio::AudioContainer::load(const string &filename,const string &filedirec handle studio::AudioContainer::get_profile(float samplerate) { #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... + + //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)) @@ -888,25 +888,25 @@ handle studio::AudioContainer::get_profile(float samplerat { return handle(); } - + #else - + return handle(); - + #endif } void studio::AudioContainer::clear() { - if(imp) + if(imp) { delete imp; imp = 0; } - + profilevalid = false; } - + void studio::AudioContainer::play(double t) { if(imp) imp->play(t); @@ -938,14 +938,14 @@ double AudioContainer::get_offset() const bool AudioContainer::is_playing() const { - if(imp) + if(imp) return imp->playing; return false; } bool AudioContainer::is_scrubbing() const { - if(imp) + if(imp) return imp->is_scrubbing(); return false; } @@ -985,19 +985,19 @@ bool AudioContainer::isPaused() const //----------- Audio imp information ------------------- -bool studio::AudioContainer::AudioImp::load(const std::string &filename, +bool studio::AudioContainer::AudioImp::load(const std::string &filename, const std::string &filedirectory) { 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)) { @@ -1005,70 +1005,70 @@ bool studio::AudioContainer::AudioImp::load(const std::string &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..."); + 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; + + //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 @@ -1078,44 +1078,44 @@ void studio::AudioContainer::AudioImp::play(double t) { #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); - + 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 + + #endif } void studio::AudioContainer::AudioImp::stop() @@ -1124,11 +1124,11 @@ void studio::AudioContainer::AudioImp::stop() #ifdef WITH_FMOD if(fmodinit.is_loaded() && playing && isRunning()) - { + { FSOUND_SetPaused(channel,true); } #endif - + playing = false; } @@ -1136,10 +1136,10 @@ void studio::AudioContainer::AudioImp::clear() { #ifdef WITH_FMOD delaycon.disconnect(); - + stop(); stop_scrubbing(); - + if(sample) { if(FSOUND_IsPlaying(channel)) @@ -1150,62 +1150,62 @@ void studio::AudioContainer::AudioImp::clear() FSOUND_Sample_Free(sample); fmodinit.decref(); } - + playing = false; - + #else channel = 0; #endif - + sample = 0; - playing = false; + playing = false; } void AudioContainer::AudioImp::start_scrubbing(double t) { //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...) + + //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); @@ -1215,21 +1215,21 @@ void AudioContainer::AudioImp::start_scrubbing(double t) void 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; } @@ -1238,9 +1238,9 @@ void AudioContainer::AudioImp::scrub(double t) #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), @@ -1248,10 +1248,10 @@ void AudioContainer::AudioImp::scrub(double t) */ double oldpos = curscrubpos; double newpos = (t - get_offset()) * sfreq; - + curscrubpos = newpos; - - //Ok the sound is running, now we need to tweek it + + //Ok the sound is running, now we need to tweek it if(newpos > oldpos) { //Outside so completely stopped... @@ -1268,19 +1268,19 @@ void AudioContainer::AudioImp::scrub(double t) 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; @@ -1288,21 +1288,21 @@ void AudioContainer::AudioImp::scrub(double t) 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?) + + //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); @@ -1310,17 +1310,17 @@ void AudioContainer::AudioImp::scrub(double t) 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) { @@ -1332,22 +1332,22 @@ void AudioContainer::AudioImp::scrub(double t) { 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); - + FSOUND_SetCurrentPosition(channel,length-1); + scrinfo.Lock(); scrinfo.pos = length-1; scrinfo.delaystart = delay_factor*buffer_length_sec; @@ -1355,35 +1355,35 @@ void AudioContainer::AudioImp::scrub(double t) 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?) + + //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... + + //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; diff --git a/synfig-studio/trunk/src/gtkmm/audiocontainer.h b/synfig-studio/trunk/src/gtkmm/audiocontainer.h index e9ff8d8..7a3a4cc 100644 --- a/synfig-studio/trunk/src/gtkmm/audiocontainer.h +++ b/synfig-studio/trunk/src/gtkmm/audiocontainer.h @@ -50,7 +50,7 @@ class AudioProfile : public etl::shared_object { public: typedef std::vector SampleProfile; - + private: SampleProfile samples; double samplerate; //samples / second of the profile @@ -62,23 +62,23 @@ 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; @@ -90,13 +90,13 @@ public: // class AudioContainer : public sigc::trackable, public etl::shared_object { etl::handle prof; - + struct AudioImp; AudioImp *imp; - - bool profilevalid; //this is only half useful + + 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(); @@ -119,7 +119,7 @@ public: //operational interface 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(); @@ -131,7 +131,7 @@ public: //operational interface bool isRunning() const; bool isPaused() const; }; - + } // END of namespace studio /* === E N D =============================================================== */ diff --git a/synfig-studio/trunk/src/gtkmm/autorecover.cpp b/synfig-studio/trunk/src/gtkmm/autorecover.cpp index d8b1ae6..1f1dea3 100644 --- a/synfig-studio/trunk/src/gtkmm/autorecover.cpp +++ b/synfig-studio/trunk/src/gtkmm/autorecover.cpp @@ -87,7 +87,7 @@ AutoRecover::AutoRecover() { // Three Minutes set_timeout(3*60*1000); - + if(mkdir(get_shadow_directory().c_str(),ACCESSPERMS)<0) { if(errno!=EEXIST) @@ -133,11 +133,11 @@ AutoRecover::get_shadow_file_name(const synfig::String& filename) 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]; @@ -156,9 +156,9 @@ AutoRecover::get_shadow_file_name(const synfig::String& filename) } } hash1^=hash2; - + return Glib::build_filename(get_shadow_directory(),strprintf("%08X-%s",hash1,basename(filename).c_str())); - + // return dirname(filename) + ETL_DIRECTORY_SEPERATOR + ".shadow_" + basename(filename); } @@ -190,7 +190,7 @@ AutoRecover::auto_backup() #ifdef HAVE_FORK pid=fork(); #endif - + if(pid<=0) { #ifdef HAVE_SETPRIORITY @@ -198,16 +198,16 @@ AutoRecover::auto_backup() // 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 @@ -215,13 +215,13 @@ AutoRecover::auto_backup() // 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); } @@ -230,7 +230,7 @@ AutoRecover::auto_backup() synfig::error("AutoRecover::auto_backup(): UNKNOWN EXCEPTION THROWN."); synfig::error("AutoRecover::auto_backup(): FILES NOT BACKED UP."); } - + #ifdef HAVE_FORK if(pid==0) { @@ -247,11 +247,11 @@ AutoRecover::auto_backup() ), 60*1000 ); -#endif - +#endif + // Also go ahead and save the settings App::save_settings(); - + return true; } @@ -270,7 +270,7 @@ AutoRecover::recovery_needed()const if(!filename.empty()) return true; } - + return false; } @@ -282,7 +282,7 @@ AutoRecover::recover() if(!file) return false; bool success=true; - + while(file) { std::string filename; @@ -295,7 +295,7 @@ AutoRecover::recover() { // 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(); } diff --git a/synfig-studio/trunk/src/gtkmm/autorecover.h b/synfig-studio/trunk/src/gtkmm/autorecover.h index df401db..7a0bc2c 100644 --- a/synfig-studio/trunk/src/gtkmm/autorecover.h +++ b/synfig-studio/trunk/src/gtkmm/autorecover.h @@ -56,14 +56,14 @@ public: void set_timeout(int milliseconds); int get_timeout()const { return timeout; } - + static synfig::String get_shadow_directory(); - + bool recovery_needed()const; bool recover(); - + void normal_shutdown(); - + void clear_backup(synfig::Canvas::Handle canvas); }; // END of class AutoRecover diff --git a/synfig-studio/trunk/src/gtkmm/canvasoptions.cpp b/synfig-studio/trunk/src/gtkmm/canvasoptions.cpp index c937586..c358d57 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasoptions.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasoptions.cpp @@ -66,7 +66,7 @@ CanvasOptions::CanvasOptions(loose_handle canvas_view): 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); @@ -79,7 +79,7 @@ CanvasOptions::CanvasOptions(loose_handle canvas_view): 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); @@ -127,15 +127,15 @@ CanvasOptions::CanvasOptions(loose_handle canvas_view): 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(); } @@ -156,14 +156,14 @@ CanvasOptions::refresh() 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); @@ -187,7 +187,7 @@ CanvasOptions::on_apply_pressed() canvas_view_->work_area->enable_grid_snap(); else canvas_view_->work_area->disable_grid_snap(); - + if(toggle_grid_show.get_active()) canvas_view_->work_area->enable_grid(); else diff --git a/synfig-studio/trunk/src/gtkmm/canvasoptions.h b/synfig-studio/trunk/src/gtkmm/canvasoptions.h index 519dddb..07e5760 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasoptions.h +++ b/synfig-studio/trunk/src/gtkmm/canvasoptions.h @@ -45,7 +45,7 @@ namespace studio { class CanvasView; - + class CanvasOptions : public Gtk::Dialog { Gtk::Tooltips tooltips; @@ -58,7 +58,7 @@ class CanvasOptions : public Gtk::Dialog Widget_Vector vector_grid_size; Gtk::CheckButton toggle_time_snap; - + public: CanvasOptions(etl::loose_handle canvas_view); ~CanvasOptions(); diff --git a/synfig-studio/trunk/src/gtkmm/canvasproperties.cpp b/synfig-studio/trunk/src/gtkmm/canvasproperties.cpp index 331f8b2..8224771 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasproperties.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasproperties.cpp @@ -79,7 +79,7 @@ CanvasProperties::CanvasProperties(Gtk::Window& parent,handleset_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); @@ -92,7 +92,7 @@ CanvasProperties::CanvasProperties(Gtk::Window& parent,handleset_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(*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)); @@ -101,10 +101,10 @@ CanvasProperties::CanvasProperties(Gtk::Window& parent,handleset_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); + 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); @@ -126,7 +126,7 @@ CanvasProperties::CanvasProperties(Gtk::Window& parent,handlesignal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasProperties::on_cancel_pressed)); //set_default_response(1); - + get_vbox()->show_all(); refresh(); @@ -138,13 +138,13 @@ 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); @@ -152,11 +152,11 @@ CanvasProperties::create_meta_data_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)); @@ -164,9 +164,9 @@ CanvasProperties::create_meta_data_view() 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)); + 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; } @@ -200,7 +200,7 @@ CanvasProperties::refresh() 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(); @@ -227,7 +227,7 @@ CanvasProperties::on_apply_pressed() canvas_interface_->set_name(entry_name.get_text()); if(entry_description.get_text()!=canvas_interface_->get_canvas()->get_description()) canvas_interface_->set_description(entry_description.get_text()); - + dirty_rend_desc=false; } diff --git a/synfig-studio/trunk/src/gtkmm/canvasproperties.h b/synfig-studio/trunk/src/gtkmm/canvasproperties.h index 98034db..270f8f1 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasproperties.h +++ b/synfig-studio/trunk/src/gtkmm/canvasproperties.h @@ -47,7 +47,7 @@ namespace Gtk { class TreeView; }; namespace synfigapp { class CanvasInterface; }; namespace studio -{ +{ class CanvasProperties : public Gtk::Dialog { Gtk::Tooltips tooltips; @@ -59,11 +59,11 @@ class CanvasProperties : public Gtk::Dialog 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(); diff --git a/synfig-studio/trunk/src/gtkmm/canvastreestore.cpp b/synfig-studio/trunk/src/gtkmm/canvastreestore.cpp index 3a4c994..a9092be 100644 --- a/synfig-studio/trunk/src/gtkmm/canvastreestore.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvastreestore.cpp @@ -99,7 +99,7 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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()); } @@ -112,7 +112,7 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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()); } @@ -125,7 +125,7 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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()); } @@ -138,7 +138,7 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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()); } @@ -151,7 +151,7 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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()); } @@ -168,8 +168,8 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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); - + return Gtk::TreeStore::get_value_vfunc(iter,column,value); + g_value_init(value.gobj(),x.value_type()); g_value_copy(x.gobj(),value.gobj()); } @@ -182,7 +182,7 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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()); } @@ -211,7 +211,7 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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()); } @@ -233,9 +233,9 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu x.set(canvas->get_id()); else if(!canvas->get_name().empty()) - x.set(canvas->get_name()); + x.set(canvas->get_name()); else - x.set(_("[Unnamed]")); + x.set(_("[Unnamed]")); x.set(_("Canvas")); } return Gtk::TreeStore::get_value_vfunc(iter,column,value); @@ -243,16 +243,16 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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])); + 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()+')'); + 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()); } @@ -265,7 +265,7 @@ CanvasTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colu 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()); @@ -303,7 +303,7 @@ 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()) { @@ -359,7 +359,7 @@ bool CanvasTreeStore::find_next_value_node(const ValueNode::Handle& value_node, Gtk::TreeIter& iter) { if(!iter) return find_first_value_node(value_node,iter); - + if(iter) do { if(!iter->children().empty()) { @@ -392,7 +392,7 @@ CanvasTreeStore::set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc, bool 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(); @@ -404,16 +404,16 @@ CanvasTreeStore::set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc, bool //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(); @@ -442,7 +442,7 @@ CanvasTreeStore::set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc, bool erase(row); return; } - + // We should never get to this point assert(0); } @@ -458,52 +458,52 @@ CanvasTreeStore::refresh_row(Gtk::TreeModel::Row &row, bool do_children) (!bool(row[model.is_value_node]) && row[model.link_count]!=0)) { set_row(row,value_desc,do_children); - return; + 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]); + 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()+')'; + 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; + return; } } else { - //row[model.label] = Glib::ustring(row[model.name]); + //row[model.label] = Glib::ustring(row[model.name]); //row[model.is_value_node] = false; //row[model.is_editable] = true; } } if(!do_children) - return; - + return; + Gtk::TreeModel::Children children = row.children(); Gtk::TreeModel::Children::iterator iter; @@ -526,14 +526,14 @@ CanvasTreeStore::rebuild_row(Gtk::TreeModel::Row &row, bool do_children) 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; + return; } LinkableValueNode::Handle linkable; @@ -543,34 +543,34 @@ CanvasTreeStore::rebuild_row(Gtk::TreeModel::Row &row, bool do_children) { // Gtk::TreeModel::Children children = row.children(); // while(!children.empty() && erase(children.begin())); - + set_row(row,value_desc); - return; + 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]); + 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()+')'; + row[model.label] = Glib::ustring(row[model.name])+" ("+value_node->get_id()+')'; } else { - row[model.label] = Glib::ustring(row[model.name]); + 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; + return; Gtk::TreeModel::Children children = row.children(); Gtk::TreeModel::Children::iterator iter; @@ -586,9 +586,9 @@ 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); @@ -603,16 +603,16 @@ 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/trunk/src/gtkmm/canvastreestore.h b/synfig-studio/trunk/src/gtkmm/canvastreestore.h index 1f29fa3..1e082f9 100644 --- a/synfig-studio/trunk/src/gtkmm/canvastreestore.h +++ b/synfig-studio/trunk/src/gtkmm/canvastreestore.h @@ -50,7 +50,7 @@ class CellRenderer_ValueBase; COLUMNID_VALUE, COLUMNID_TIME_TRACK, COLUMNID_TYPE, - + COLUMNID_END //!< \internal }; #define COLUMNID_NAME COLUMNID_ID @@ -85,9 +85,9 @@ public: Gtk::TreeModelColumn is_shared; Gtk::TreeModelColumn is_exported; - + Gtk::TreeModelColumn value_desc; - + Gtk::TreeModelColumn tooltip; Model() @@ -109,7 +109,7 @@ public: add(value_desc); add(link_count); add(link_id); - + add(tooltip); } }; @@ -119,7 +119,7 @@ public: */ public: - + const Model model; //std::multimap, sigc::connection> connection_map; @@ -152,7 +152,7 @@ private: */ public: - + CanvasTreeStore(etl::loose_handle canvas_interface_); ~CanvasTreeStore(); @@ -170,8 +170,8 @@ public: 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); @@ -185,7 +185,7 @@ public: */ public: - + }; // END of class CanvasTreeStore }; // END of namespace studio diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index 493935e..43d8de9 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasview.cpp @@ -45,9 +45,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -156,17 +156,17 @@ using namespace SigC; #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): @@ -177,12 +177,12 @@ public: 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 @@ -192,14 +192,14 @@ public: scrub_timer.reset(); return; } - + // If we aren't scrubbing already, enable it if(!scrubbing) { - scrubbing=true; + 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( @@ -215,14 +215,14 @@ public: scrub_timer.reset(); } - + void end_of_scrubbing() - { + { scrubbing=false; audio_container()->stop_scrubbing(); scrub_timer.reset(); } - + handle audio_container() { assert(canvas_view->audio); @@ -230,7 +230,7 @@ public: } }; - + class studio::CanvasViewUIInterface : public synfigapp::UIInterface { CanvasView *view; @@ -240,7 +240,7 @@ public: CanvasViewUIInterface(CanvasView *view): view(view) { - + view->statusbar->push("Idle"); } @@ -262,11 +262,11 @@ public: ); 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(); @@ -283,12 +283,12 @@ public: ); 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(); @@ -305,11 +305,11 @@ public: ); 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(); @@ -319,7 +319,7 @@ public: task(const std::string &task) { if(!view->is_playing_) - { + { view->statusbar->pop(); view->statusbar->push(task); } @@ -332,7 +332,7 @@ public: 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 @@ -349,7 +349,7 @@ public: { view->statusbar->pop(); view->statusbar->push(err); - + //while(studio::App::events_pending())studio::App::iteration(false); if(view->cancel)return false; return true; @@ -359,7 +359,7 @@ public: amount_complete(int current, int total) { if(!view->is_playing_) - { + { if(!view->working_depth) { if(current) @@ -376,7 +376,7 @@ public: if(view->cancel){/*view->cancel=false;*/return false;} return true; } - + void not_implemented() { @@ -392,10 +392,10 @@ class studio::CanvasViewSelectionManager : public synfigapp::SelectionManager public: CanvasViewSelectionManager(CanvasView *view): view(view) -{ - +{ + } - + private: void _set_selected_layer(const synfig::Layer::Handle &layer) @@ -407,7 +407,7 @@ private: // 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()); @@ -434,7 +434,7 @@ private: */ } public: - + //! Returns the number of layers selected. virtual int get_selected_layer_count()const { @@ -445,25 +445,25 @@ public: virtual LayerList get_selected_layers()const { // assert(view->layer_tree); - + if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); 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) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); 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) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return; } view->layer_tree->select_layers(layer_list); //view->get_smach().process_event(EVENT_REFRESH_DUCKS); @@ -475,7 +475,7 @@ public: virtual void set_selected_layer(const synfig::Layer::Handle &layer) { // assert(view->layer_tree); - + if(!view->layer_tree) { DEBUGPOINT(); synfig::error("canvas_view.layer_tree not defined!?"); return; } view->layer_tree->select_layer(layer); //view->queue_rebuild_ducks(); @@ -495,7 +495,7 @@ public: { return get_selected_children().size(); } - + static inline void __child_grabber(const Gtk::TreeModel::iterator& iter, ChildrenList* ret) { const CanvasView::ChildrenTreeModel children_tree_model; @@ -503,19 +503,19 @@ public: 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( @@ -524,7 +524,7 @@ public: &ret ) ); - + /* Gtk::TreeModel::Children::iterator iter(view->children_tree_store()->children().begin()); iter++; @@ -538,7 +538,7 @@ public: */ return ret; } - + //! Returns the first value_node selected or an empty handle if none are selected. virtual ChildrenList::value_type get_selected_child()const { @@ -551,7 +551,7 @@ public: return children.front(); } - + //! Sets which value_nodes should be selected virtual void set_selected_children(const ChildrenList &children_list) { @@ -569,14 +569,14 @@ public: { 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(); @@ -585,9 +585,9 @@ public: 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) @@ -603,23 +603,23 @@ public: } 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; @@ -663,16 +663,16 @@ CanvasView::CanvasView(etl::loose_handle instance,etl::handle instance,etl::handleset_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); @@ -707,25 +707,25 @@ CanvasView::CanvasView(etl::loose_handle instance,etl::handleshow(); - + //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, 3, false)); + + Gtk::Table *layout_table= manage(new class Gtk::Table(1, 3, 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); - init_menus(); + 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(); @@ -748,10 +748,10 @@ CanvasView::CanvasView(etl::loose_handle instance,etl::handlesignal_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_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)); @@ -776,20 +776,20 @@ CanvasView::CanvasView(etl::loose_handle instance,etl::handlequeue_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 + /*! \todo In other words, this is a zoom-to-fit, and should be ** in it's own function. */ int w=get_canvas()->rend_desc().get_w()+70; @@ -799,15 +799,15 @@ CanvasView::CanvasView(etl::loose_handle instance,etl::handlezoom_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; + 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") ); @@ -830,38 +830,38 @@ CanvasView::CanvasView(etl::loose_handle instance,etl::handlesignal_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 + + //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"); /* { @@ -870,12 +870,12 @@ CanvasView::CanvasView(etl::loose_handle instance,etl::handlesecond) delete ext_widget_book_.begin()->second; } - + //delete preview audio.reset(); - + hide(); - + synfig::info("CanvasView:~CanvasView(): Destructor Finished"); } @@ -923,8 +923,8 @@ CanvasView::create_time_bar() 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); - - + + tooltips.set_tip(*time_window_scroll,_("Moves the time window")); tooltips.set_tip(*timeslider,_("Changes the current time")); time_window_scroll->show(); @@ -934,7 +934,7 @@ CanvasView::create_time_bar() //time_scroll->signal_value_changed().connect(sigc::mem_fun(*work_area, &studio::WorkArea::render_preview_hook)); //time_scroll->set_update_policy(Gtk::UPDATE_DISCONTINUOUS); - + NORMAL_BUTTON(animatebutton,"gtk-yes","Animate"); animatebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_animate_button_pressed)); animatebutton->show(); @@ -942,11 +942,11 @@ CanvasView::create_time_bar() NORMAL_BUTTON(keyframebutton,"synfig-keyframe_lock_all","All Keyframes Locked"); keyframebutton->signal_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_keyframe_button_pressed)); keyframebutton->show(); - + Gtk::Table *table= manage(new class Gtk::Table(2, 3, false)); //setup the audio display - disp_audio->set_size_request(-1,32); //disp_audio.show(); + 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) @@ -957,7 +957,7 @@ CanvasView::create_time_bar() disp_audio->signal_stop_scrubbing().connect( sigc::mem_fun(*audio,&AudioContainer::stop_scrubbing) ); - + table->attach(*manage(disp_audio), 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); table->attach(*timeslider, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0); table->attach(*time_window_scroll, 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK, 0, 0); @@ -1030,7 +1030,7 @@ CanvasView::create_status_bar() refreshbutton->signal_clicked().connect(SLOT_EVENT(EVENT_REFRESH)); stopbutton->signal_clicked().connect(SLOT_EVENT(EVENT_STOP)); - + statusbartable->show_all(); return statusbartable; } @@ -1058,7 +1058,7 @@ CanvasView::create_children_tree() if(children_tree)children_tree->signal_waypoint_clicked().connect(sigc::mem_fun(*this, &studio::CanvasView::on_waypoint_clicked)); if(children_tree)children_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS)); - return children_tree; + return children_tree; } Gtk::Widget* @@ -1073,7 +1073,7 @@ CanvasView::create_keyframe_tree() //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); @@ -1081,10 +1081,10 @@ CanvasView::create_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)); + + 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")); @@ -1094,18 +1094,18 @@ CanvasView::create_keyframe_tree() 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)); @@ -1113,11 +1113,11 @@ CanvasView::create_keyframe_tree() //layout_table->show_all(); keyframe_tab_child=layout_table; - - + + layout_table->hide(); - - return layout_table; + + return layout_table; } Gtk::Widget* @@ -1140,7 +1140,7 @@ CanvasView::create_layer_tree() layer_tree->get_selection()->signal_changed().connect(SLOT_EVENT(EVENT_REFRESH_DUCKS)); layer_tree->hide(); - return layer_tree; + return layer_tree; } void @@ -1160,7 +1160,7 @@ CanvasView::init_menus() layermenu.set_accel_path("/Layer"); */ //cache the position of desired widgets - + /*Menus to worry about: - filemenu - editmenu @@ -1171,7 +1171,7 @@ CanvasView::init_menus() - viewmenu */ action_group = Gtk::ActionGroup::create(); - + //action_group->add( Gtk::Action::create("MenuFile", "_File") ); action_group->add( Gtk::Action::create("save", Gtk::Stock::SAVE), hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::save)) @@ -1210,7 +1210,7 @@ CanvasView::init_menus() sigc::mem_fun0(canvas_options,&studio::CanvasOptions::present) ); action_group->add( Gtk::Action::create("close", Gtk::StockID("gtk-close")), - sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close)) + sigc::hide_return(sigc::mem_fun(*this,&studio::CanvasView::close)) ); //action_group->add( Gtk::Action::create("undo", Gtk::StockID("gtk-undo")), @@ -1232,7 +1232,7 @@ CanvasView::init_menus() 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) ); @@ -1267,7 +1267,7 @@ CanvasView::init_menus() action_group->add( Gtk::Action::create("play", Gtk::StockID("synfig-play")), sigc::mem_fun(*this, &studio::CanvasView::play) ); - + action_group->add( Gtk::Action::create("dialog-flipbook", _("Flipbook Dialog")), sigc::mem_fun0(*preview_dialog, &studio::Dialog_Preview::present) ); @@ -1299,7 +1299,7 @@ CanvasView::init_menus() { 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")); @@ -1326,16 +1326,16 @@ CanvasView::init_menus() 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) ); - + } @@ -1347,7 +1347,7 @@ CanvasView::init_menus() sigc::mem_fun(*this, &studio::CanvasView::toggle_duck_mask), \ Duck::TYPE_##upper \ ) \ - ) + ) DUCK_MASK(position,POSITION); DUCK_MASK(tangent,TANGENT); DUCK_MASK(vertex,VERTEX); @@ -1363,7 +1363,7 @@ CanvasView::init_menus() { 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)); @@ -1378,16 +1378,16 @@ CanvasView::init_menus() 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 = @@ -1406,7 +1406,7 @@ CanvasView::init_menus() 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); @@ -1415,10 +1415,10 @@ CanvasView::init_menus() -#if 0 - +#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)))); @@ -1437,11 +1437,11 @@ CanvasView::init_menus() )); 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) @@ -1487,7 +1487,7 @@ CanvasView::init_menus() 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 @@ -1557,7 +1557,7 @@ CanvasView::init_menus() viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Mask Ducks"),duckmaskmenu)); } - + // Preview Quality Menu if(1) { @@ -1580,7 +1580,7 @@ CanvasView::init_menus() } viewmenu.items().push_back(Gtk::Menu_Helpers::MenuElem(_("Preview Quality"),qualitymenu)); } - + viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-play"), sigc::mem_fun(*this, &studio::CanvasView::play))); viewmenu.items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("Flipbook Dialog"), @@ -1596,7 +1596,7 @@ CanvasView::init_menus() 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)), @@ -1627,9 +1627,9 @@ CanvasView::init_menus() 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)); @@ -1657,7 +1657,7 @@ CanvasView::init_menus() canvasmenu.set_accel_path("/Canvas"); viewmenu.set_accel_path("/View"); duckmaskmenu.set_accel_path("/DuckMask"); -#endif +#endif } void @@ -1673,9 +1673,9 @@ CanvasView::show_keyframe_dialog() 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(); } @@ -1685,11 +1685,11 @@ 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(); @@ -1700,12 +1700,12 @@ CanvasView::add_layer(synfig::String x) 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); + get_selection_manager()->set_selected_layer(layer); } } @@ -1715,16 +1715,16 @@ 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") @@ -1739,9 +1739,9 @@ CanvasView::popup_layer_menu(synfig::Layer::Handle layer) ) )); } - + add_actions_to_menu(menu, param_list,synfigapp::Action::CATEGORY_LAYER); - + menu->popup(3,gtk_get_current_event_time()); } @@ -1750,7 +1750,7 @@ CanvasView::register_layer_type(synfig::Layer::Book::value_type &lyr,std::mapcount(lyr.second.category)==0) (*category_map)[lyr.second.category]=manage(new Gtk::Menu()); @@ -1788,7 +1788,7 @@ CanvasView::build_new_layer_menu(Gtk::Menu &menu) 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.items().push_back(Gtk::Menu_Helpers::MenuElem(iter->first,*iter->second)); menu.show(); */ @@ -1829,7 +1829,7 @@ 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())) @@ -1852,7 +1852,7 @@ CanvasView::refresh_rend_desc() //set the FPS of the timeslider timeslider->set_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(); @@ -1868,35 +1868,35 @@ CanvasView::refresh_rend_desc() 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(); @@ -1912,13 +1912,13 @@ CanvasView::refresh_rend_desc() 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", @@ -2009,14 +2009,14 @@ CanvasView::on_focus_in_event(GdkEventFocus*x) 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; } @@ -2054,10 +2054,10 @@ CanvasView::on_layer_toggle(synfig::Layer::Handle layer) { synfigapp::Action::Handle action(synfigapp::Action::create("layer_activate")); 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()))) @@ -2067,7 +2067,7 @@ CanvasView::on_layer_toggle(synfig::Layer::Handle layer) action->set_param("new_status",!layer->active()); assert(action->is_ready()); - + canvas_interface()->get_instance()->perform_action(action); } @@ -2077,7 +2077,7 @@ CanvasView::popup_param_menu(synfigapp::ValueDesc value_desc, float location) { parammenu.items().clear(); get_instance()->make_param_menu(¶mmenu,get_canvas(),value_desc,location); - + parammenu.popup(3,gtk_get_current_event_time()); } @@ -2089,7 +2089,7 @@ CanvasView::add_actions_to_menu(Gtk::Menu *menu, const synfigapp::Action::ParamL bool CanvasView::on_layer_user_click(int button, Gtk::TreeRow row, LayerTree::ColumnID column_id) -{ +{ switch(button) { case 3: @@ -2103,10 +2103,10 @@ CanvasView::on_layer_user_click(int button, Gtk::TreeRow row, LayerTree::ColumnI 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; @@ -2118,15 +2118,15 @@ CanvasView::on_layer_user_click(int button, Gtk::TreeRow row, LayerTree::ColumnI 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]; @@ -2144,16 +2144,16 @@ CanvasView::on_layer_user_click(int button, Gtk::TreeRow row, LayerTree::ColumnI { 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())); build_new_layer_menu(*newlayers); - + parammenu.items().push_back(Gtk::Menu_Helpers::MenuElem("New Layer",*newlayers)); if(!multiple_selected && layer->get_name()=="PasteCanvas") { @@ -2167,14 +2167,14 @@ CanvasView::on_layer_user_click(int button, Gtk::TreeRow row, LayerTree::ColumnI ) )); } - + 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; @@ -2207,10 +2207,10 @@ CanvasView::on_layer_user_click(int button, Gtk::TreeRow row, LayerTree::ColumnI } return true; break; - + default: return false; - break; + break; } } @@ -2218,7 +2218,7 @@ CanvasView::on_layer_user_click(int button, Gtk::TreeRow row, LayerTree::ColumnI bool CanvasView::on_children_user_click(int button, Gtk::TreeRow row, ChildrenTree::ColumnID column_id) -{ +{ switch(button) { case 3: @@ -2235,10 +2235,10 @@ CanvasView::on_children_user_click(int button, Gtk::TreeRow row, ChildrenTree::C } return true; break; - + default: return false; - break; + break; } } @@ -2250,7 +2250,7 @@ CanvasView::on_keyframe_tree_event(GdkEvent *event) case GDK_BUTTON_PRESS: switch(event->button.button) { - case 3: + case 3: { //keyframemenu.popup(event->button.button,gtk_get_current_event_time()); return true; @@ -2275,14 +2275,14 @@ 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(); @@ -2292,18 +2292,18 @@ 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")); + 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()) @@ -2314,7 +2314,7 @@ CanvasView::on_time_changed() } time_adjustment().set_value(time); time_adjustment().value_changed(); - + // Shouldn't these trees just hook into // the time changed signal...? //YES THEY SHOULD... @@ -2328,7 +2328,7 @@ CanvasView::time_zoom_in() { time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()*0.75); time_window_adjustment().changed(); - + refresh_time_window(); } @@ -2337,7 +2337,7 @@ CanvasView::time_zoom_out() { time_window_adjustment().set_page_size(time_window_adjustment().get_page_size()/0.75); time_window_adjustment().changed(); - + refresh_time_window(); } @@ -2359,7 +2359,7 @@ 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]); @@ -2386,8 +2386,8 @@ CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode) { Gtk::Image *icon; icon=manage(new Gtk::Image(Gtk::StockID("gtk-no"),Gtk::ICON_SIZE_BUTTON)); - animatebutton->remove(); - animatebutton->add(*icon); + animatebutton->remove(); + animatebutton->add(*icon); tooltips.set_tip(*animatebutton,_("In Animate Editing Mode")); icon->set_padding(0,0); icon->show(); @@ -2396,8 +2396,8 @@ CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode) { Gtk::Image *icon; icon=manage(new Gtk::Image(Gtk::StockID("gtk-yes"),Gtk::ICON_SIZE_BUTTON)); - animatebutton->remove(); - animatebutton->add(*icon); + animatebutton->remove(); + animatebutton->add(*icon); tooltips.set_tip(*animatebutton,_("Not in Animate Editing Mode")); icon->set_padding(0,0); icon->show(); @@ -2407,8 +2407,8 @@ CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode) { Gtk::Image *icon; icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_all"),Gtk::ICON_SIZE_BUTTON)); - keyframebutton->remove(); - keyframebutton->add(*icon); + keyframebutton->remove(); + keyframebutton->add(*icon); tooltips.set_tip(*keyframebutton,_("All Keyframes Locked")); icon->set_padding(0,0); icon->show(); @@ -2417,8 +2417,8 @@ CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode) { Gtk::Image *icon; icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_future"),Gtk::ICON_SIZE_BUTTON)); - keyframebutton->remove(); - keyframebutton->add(*icon); + keyframebutton->remove(); + keyframebutton->add(*icon); tooltips.set_tip(*keyframebutton,_("Future Keyframes Locked")); icon->set_padding(0,0); icon->show(); @@ -2427,8 +2427,8 @@ CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode) { Gtk::Image *icon; icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_past"),Gtk::ICON_SIZE_BUTTON)); - keyframebutton->remove(); - keyframebutton->add(*icon); + keyframebutton->remove(); + keyframebutton->add(*icon); tooltips.set_tip(*keyframebutton,_("Past Keyframes Locked")); icon->set_padding(0,0); icon->show(); @@ -2437,13 +2437,13 @@ CanvasView::on_mode_changed(synfigapp::CanvasInterface::Mode mode) { Gtk::Image *icon; icon=manage(new Gtk::Image(Gtk::StockID("synfig-keyframe_lock_none"),Gtk::ICON_SIZE_BUTTON)); - keyframebutton->remove(); - keyframebutton->add(*icon); + keyframebutton->remove(); + keyframebutton->add(*icon); tooltips.set_tip(*keyframebutton,_("No Keyframes Locked")); icon->set_padding(0,0); icon->show(); } - + work_area->queue_draw(); } @@ -2460,7 +2460,7 @@ void CanvasView::on_keyframe_button_pressed() { synfigapp::CanvasInterface::Mode mode(get_mode()); - + if((mode&synfigapp::MODE_ANIMATE_FUTURE) && (mode&synfigapp::MODE_ANIMATE_PAST)) { set_mode(get_mode()-synfigapp::MODE_ANIMATE_FUTURE); @@ -2528,8 +2528,8 @@ CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, Canvas { int transforms(0); String layer_name; - -#define QUEUE_REBUILD_DUCKS sigc::mem_fun(*this,&CanvasView::queue_rebuild_ducks) + +#define QUEUE_REBUILD_DUCKS sigc::mem_fun(*this,&CanvasView::queue_rebuild_ducks) if(!canvas) { @@ -2550,17 +2550,17 @@ CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, Canvas // 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 pf 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()) @@ -2582,15 +2582,15 @@ CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, Canvas *this, &studio::CanvasView::selected_layer_color_set ) - ); + ); } */ } } } - + layer_name=layer->get_name(); - + if(layer->active()) { Transform::Handle trans(layer->get_transform()); @@ -2626,7 +2626,7 @@ CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, Canvas } */ } - + // If this is a paste canvas layer, then we need to // descend into it if(layer_name=="PasteCanvas") @@ -2634,16 +2634,16 @@ CanvasView::rebuild_ducks_layer_(synfig::TransformStack& transform_stack, Canvas 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())); - + if(!scale.is_equal_to(Vector(1,1))) transform_stack.push(new Transform_Scale(scale,origin)); if(!scale.is_equal_to(Vector(0,0))) transform_stack.push(new Transform_Translate(origin)); - + rebuild_ducks_layer_(transform_stack,child_canvas,selected_list); - + if(!scale.is_equal_to(Vector(0,0))) transform_stack.pop(); if(!scale.is_equal_to(Vector(1,1))) @@ -2662,11 +2662,11 @@ CanvasView::queue_rebuild_ducks() #if 0 if(rebuild_ducks_queued) return; -#else +#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), @@ -2674,36 +2674,36 @@ CanvasView::queue_rebuild_ducks() ), 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()); @@ -2712,20 +2712,20 @@ CanvasView::rebuild_ducks() 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... + + // 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); @@ -2735,7 +2735,7 @@ CanvasView::rebuild_ducks() 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; @@ -2768,13 +2768,13 @@ 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(), @@ -2783,16 +2783,16 @@ CanvasView::play() // 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; + + 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( @@ -2802,7 +2802,7 @@ CanvasView::play() ); timewindreset = true; } - + while( time + timer() < Time(time_window_adjustment().get_sub_lower()) ) { time_window_adjustment().set_value( @@ -2810,26 +2810,26 @@ CanvasView::play() 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; - + studio::App::iteration(false); - + if(get_cancel_status()) return; } - is_playing_=false; + is_playing_=false; time_adjustment().set_value(endtime); time_adjustment().value_changed(); @@ -2844,7 +2844,7 @@ CanvasView::show_tables() { 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->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-down"),iconsize))); treetogglebutton->show_all(); notebook->show(); } @@ -2860,7 +2860,7 @@ CanvasView::hide_tables() { 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->add(*manage(new Gtk::Image(Gtk::StockID("gtk-go-up"),iconsize))); treetogglebutton->show_all(); notebook->hide(); } @@ -2912,7 +2912,7 @@ CanvasView::show_timebar() { timebar->show(); current_time_widget->show(); - + //keyframe_tab_child->show(); if(layer_tree) layer_tree->set_show_timetrack(true); @@ -2976,7 +2976,7 @@ CanvasView::on_waypoint_clicked(synfigapp::ValueDesc value_desc,synfig::Waypoint &Gtk::Widget::show ) )); - + waypoint_menu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("synfig-duplicate"), sigc::bind( sigc::bind( @@ -3043,7 +3043,7 @@ CanvasView::on_drop_drag_data_received(const Glib::RefPtr& con //synfig::info("Droped data of type \"%s\"",selection_data.get_data_type()); //synfig::info("Droped 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 @@ -3057,44 +3057,44 @@ CanvasView::on_drop_drag_data_received(const Glib::RefPtr& con break; synfigapp::Action::Handle action(synfigapp::Action::create("layer_add")); - + 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 successfuly 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 URL's seperated // by not only Carrage-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://") @@ -3102,13 +3102,13 @@ CanvasView::on_drop_drag_data_received(const Glib::RefPtr& con 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; try{ext=(String(filename.begin()+filename.find_last_of('.')+1,filename.end()));}catch(...){continue;} - + // If this is a SIF file, then we need to do things slightly differently if(ext=="sketch") { @@ -3144,8 +3144,8 @@ CanvasView::on_keyframe_add_pressed() { 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())); @@ -3163,7 +3163,7 @@ CanvasView::on_keyframe_duplicate_pressed() { ui_interface_->error("I am unable to duplicate the keyframe"); return; - } + } keyframe=row[model.keyframe]; synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_duplicate")); @@ -3172,8 +3172,8 @@ CanvasView::on_keyframe_duplicate_pressed() { 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); @@ -3192,7 +3192,7 @@ CanvasView::on_keyframe_remove_pressed() { ui_interface_->error("I am unable to remove the keyframe"); return; - } + } keyframe=row[model.keyframe]; synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_remove")); @@ -3201,8 +3201,8 @@ CanvasView::on_keyframe_remove_pressed() { 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); @@ -3222,22 +3222,22 @@ CanvasView::toggle_duck_mask(Duckmatic::Type type) if(duck_mask_position) duck_mask_position->set_active(!is_currently_on); break; - + case Duck::TYPE_VERTEX: if(duck_mask_vertex) duck_mask_vertex->set_active(!is_currently_on); break; - + case Duck::TYPE_TANGENT: if(duck_mask_tangent) duck_mask_tangent->set_active(!is_currently_on); break; - + case Duck::TYPE_RADIUS: if(duck_mask_radius) duck_mask_radius->set_active(!is_currently_on); break; - + case Duck::TYPE_WIDTH: if(duck_mask_width) duck_mask_width->set_active(!is_currently_on); @@ -3257,7 +3257,7 @@ CanvasView::toggle_duck_mask(Duckmatic::Type type) 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(); } @@ -3284,7 +3284,7 @@ CanvasView::on_input_device_changed(GdkDevice* 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()); @@ -3295,9 +3295,9 @@ 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(); @@ -3316,7 +3316,7 @@ CanvasView::on_preview_option() 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); @@ -3325,7 +3325,7 @@ CanvasView::on_preview_option() 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(); @@ -3335,10 +3335,10 @@ CanvasView::on_preview_option() 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); @@ -3350,10 +3350,10 @@ CanvasView::on_preview_create(const PreviewInfo &info) //render it out... prev->render(); - + Dialog_Preview *pd = preview_dialog.get(); assert(pd); - + pd->set_preview(prev.get()); pd->present(); } @@ -3368,7 +3368,7 @@ CanvasView::on_audio_option() 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); } @@ -3384,7 +3384,7 @@ 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()); @@ -3393,25 +3393,25 @@ CanvasView::on_audio_file_notify() disp_audio->set_profile(etl::handle()); }else { - //save in canvasview + //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!"); + 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(); @@ -3424,7 +3424,7 @@ CanvasView::on_audio_offset_notify() 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()); } @@ -3435,7 +3435,7 @@ CanvasView::play_audio(float t) { synfig::info("Playing audio at %f s",t); audio->play(t); - } + } } void @@ -3547,6 +3547,6 @@ CanvasView::on_delete_event(GdkEventAny* event) } if(event) return Gtk::Window::on_delete_event(event); - + return true; } diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.h b/synfig-studio/trunk/src/gtkmm/canvasview.h index efe10cf..21f7216 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.h +++ b/synfig-studio/trunk/src/gtkmm/canvasview.h @@ -89,7 +89,7 @@ #if _DEBUG #define DEBUGPOINT_CLASS(x) struct debugpointclass_ ## x { debugpointclass_ ## x () { DEBUGPOINT(); } ~debugpointclass_ ## x () { DEBUGPOINT(); } } badfthguae_ ## x ; #else -#define DEBUGPOINT_CLASS(x) +#define DEBUGPOINT_CLASS(x) #endif #endif @@ -112,11 +112,11 @@ class Duckmatic; class Preview; struct PreviewInfo; class AudioContainer; - + class Widget_Sound; class Widget_Timeslider; class Widget_Time; - + class Dialog_SoundSelect; class Dialog_Preview; @@ -124,29 +124,29 @@ class synfig::TransformStack; 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; @@ -202,9 +202,9 @@ private: SigC::Connection playcon; SigC::Connection stopcon; - + std::auto_ptr universal_scrubber; - + //! Tooltip controler Gtk::Tooltips tooltips; @@ -223,7 +223,7 @@ private: //Glib::RefPtr keyframe_tree_store_; DEBUGPOINT_CLASS(5); - + //std::map > tree_model_book_; std::map > ref_obj_book_; std::map ext_widget_book_; @@ -231,14 +231,14 @@ private: //! 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; @@ -247,10 +247,10 @@ private: 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; @@ -259,7 +259,7 @@ private: Widget_Time *current_time_widget; void on_current_time_widget_changed(); - + std::auto_ptr timeslider; std::list duck_changed_connections; @@ -268,7 +268,7 @@ private: Gtk::Button *animatebutton; Gtk::Button *keyframebutton; - + /* DEBUGPOINT_CLASS(8); Gtk::Menu duckmaskmenu; @@ -316,13 +316,13 @@ private: Glib::RefPtr duck_mask_angle; Gtk::RadioButtonGroup quality_group; - + Glib::RefPtr action_group; etl::handle ui_interface_; etl::handle selection_manager_; - + bool is_playing_; sigc::signal signal_deleted_; @@ -370,7 +370,7 @@ public: */ private: - + // Constructor is private to force the use of the "create()" constructor CanvasView(etl::loose_handle instance,etl::handle canvas_interface); @@ -395,8 +395,8 @@ private: void time_was_changed(); - void refresh_rend_desc(); - + void refresh_rend_desc(); + void toggle_duck_mask(Duckmatic::Type type); Gtk::Widget *create_work_area(); @@ -407,14 +407,14 @@ private: void popup_param_menu_bezier(float location, synfigapp::ValueDesc value_desc) { popup_param_menu(value_desc,location); } - + void popup_param_menu(synfigapp::ValueDesc value_desc, float location=0); 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*); @@ -443,7 +443,7 @@ public: 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_; } @@ -452,23 +452,23 @@ public: 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_;} @@ -476,19 +476,19 @@ public: 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(); } @@ -544,24 +544,24 @@ public: //! \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(); @@ -581,28 +581,28 @@ public: 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(synfigapp::ValueDesc,synfig::Waypoint, int button); - + void preview_option() {on_preview_option();} - + void present(); - + /* -- ** -- S I G N A L T E R M I N A L S ------------------------------------- */ private: - + void on_unselect_layers(); void on_input_device_changed(GdkDevice*); @@ -611,7 +611,7 @@ private: 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); @@ -625,21 +625,21 @@ private: 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(); /* @@ -648,7 +648,7 @@ private: void on_layer_duplicate_pressed(); void on_layer_delete_pressed(); */ - + void on_keyframe_add_pressed(); void on_keyframe_duplicate_pressed(); @@ -658,17 +658,17 @@ private: 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); void on_layer_toggle(synfig::Layer::Handle); @@ -678,19 +678,19 @@ private: //void on_waypoint_clicked(synfigapp::ValueDesc,synfig::ValueNode_Animated::WaypointList::iterator, int button); 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(); protected: 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); }; // END of class CanvasView diff --git a/synfig-studio/trunk/src/gtkmm/cellrenderer_gradient.h b/synfig-studio/trunk/src/gtkmm/cellrenderer_gradient.h index 1772be0..7ce391e 100644 --- a/synfig-studio/trunk/src/gtkmm/cellrenderer_gradient.h +++ b/synfig-studio/trunk/src/gtkmm/cellrenderer_gradient.h @@ -57,12 +57,12 @@ public: {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, diff --git a/synfig-studio/trunk/src/gtkmm/cellrenderer_time.cpp b/synfig-studio/trunk/src/gtkmm/cellrenderer_time.cpp index ef733ce..3072d2d 100644 --- a/synfig-studio/trunk/src/gtkmm/cellrenderer_time.cpp +++ b/synfig-studio/trunk/src/gtkmm/cellrenderer_time.cpp @@ -97,7 +97,7 @@ CellRenderer_Time::render_vfunc( 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); @@ -119,7 +119,7 @@ CellRenderer_Time::start_editing_vfunc( 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)); diff --git a/synfig-studio/trunk/src/gtkmm/cellrenderer_time.h b/synfig-studio/trunk/src/gtkmm/cellrenderer_time.h index cfccbd4..28a89eb 100644 --- a/synfig-studio/trunk/src/gtkmm/cellrenderer_time.h +++ b/synfig-studio/trunk/src/gtkmm/cellrenderer_time.h @@ -63,12 +63,12 @@ public: 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, diff --git a/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp b/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp index 9c2a829..754d260 100644 --- a/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp +++ b/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp @@ -77,7 +77,7 @@ 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_), @@ -129,20 +129,20 @@ const synfig::Node::time_set *get_times_from_vdesc(const synfigapp::ValueDesc &v if(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 = + + 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) { @@ -157,33 +157,33 @@ const synfig::Node::time_set *get_times_from_vdesc(const synfigapp::ValueDesc &v 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(); - + //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; } @@ -198,7 +198,7 @@ CellRenderer_TimeTrack::render_vfunc( { if(!window) return; - + Glib::RefPtr gc(Gdk::GC::create(window)); Glib::RefPtr inactive_gc(Gdk::GC::create(window)); Gtk::Adjustment *adjustment=get_adjustment(); @@ -217,9 +217,9 @@ CellRenderer_TimeTrack::render_vfunc( 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); @@ -233,61 +233,61 @@ CellRenderer_TimeTrack::render_vfunc( { 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) { 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