Lines Matching defs:dtw

110 static gint sp_desktop_widget_event (GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dtw);
112 static void sp_dtw_color_profile_event(EgeColorProfTracker *widget, SPDesktopWidget *dtw);
117 static void cms_adjust_set_sensitive( SPDesktopWidget *dtw, bool enabled );
118 static void sp_desktop_widget_adjustment_value_changed (GtkAdjustment *adj, SPDesktopWidget *dtw);
152 void add( SPDesktopWidget* dtw ) {
153 _widget_list.push_back(dtw);
155 void remove( SPDesktopWidget* dtw ) {
156 _widget_list.remove(dtw);
228 SPDesktopWidget *dtw = *it;
229 if ( gtk_widget_get_sensitive( dtw->cms_adjust ) != enabled ) {
230 cms_adjust_set_sensitive( dtw, enabled );
329 SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(data);
330 sp_desktop_widget_update_rulers(dtw);
336 void SPDesktopWidget::init( SPDesktopWidget *dtw )
340 new (&dtw->modified_connection) sigc::connection();
342 dtw->window = 0;
343 dtw->desktop = NULL;
344 dtw->_interaction_disabled_counter = 0;
348 dtw->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
350 dtw->vbox = gtk_vbox_new (FALSE, 0);
352 gtk_container_add( GTK_CONTAINER(dtw), GTK_WIDGET(dtw->vbox) );
355 dtw->statusbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
357 dtw->statusbar = gtk_hbox_new (FALSE, 0);
359 //gtk_widget_set_usize (dtw->statusbar, -1, BOTTOM_BAR_HEIGHT);
360 gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->statusbar, FALSE, TRUE, 0);
365 dtw->panels = new SwatchesPanel("/embedded/swatches" /*false*/);
366 dtw->panels->setOrientation(SP_ANCHOR_SOUTH);
369 dtw->panels->set_vexpand(false);
372 gtk_box_pack_end( GTK_BOX( dtw->vbox ), GTK_WIDGET(dtw->panels->gobj()), FALSE, TRUE, 0 );
376 dtw->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
378 dtw->hbox = gtk_hbox_new(FALSE, 0);
381 gtk_box_pack_end( GTK_BOX (dtw->vbox), dtw->hbox, TRUE, TRUE, 0 );
382 gtk_widget_show(dtw->hbox);
384 dtw->aux_toolbox = ToolboxFactory::createAuxToolbox();
385 gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->aux_toolbox, FALSE, TRUE, 0);
387 dtw->snap_toolbox = ToolboxFactory::createSnapToolbox();
388 ToolboxFactory::setOrientation( dtw->snap_toolbox, GTK_ORIENTATION_VERTICAL );
389 gtk_box_pack_end( GTK_BOX(dtw->hbox), dtw->snap_toolbox, FALSE, TRUE, 0 );
391 dtw->commands_toolbox = ToolboxFactory::createCommandsToolbox();
392 gtk_box_pack_end (GTK_BOX (dtw->vbox), dtw->commands_toolbox, FALSE, TRUE, 0);
394 dtw->tool_toolbox = ToolboxFactory::createToolToolbox();
395 ToolboxFactory::setOrientation( dtw->tool_toolbox, GTK_ORIENTATION_VERTICAL );
396 gtk_box_pack_start( GTK_BOX(dtw->hbox), dtw->tool_toolbox, FALSE, TRUE, 0 );
398 dtw->guides_lock = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION,
406 Gtk::Widget * wnd = Glib::wrap(dtw->guides_lock);
414 dtw->hruler = sp_ruler_new(GTK_ORIENTATION_HORIZONTAL);
415 dtw->hruler_box = eventbox;
417 sp_ruler_set_unit(SP_RULER(dtw->hruler), pt);
418 gtk_widget_set_tooltip_text (dtw->hruler_box, gettext(pt->name_plural.c_str()));
419 gtk_container_add (GTK_CONTAINER (eventbox), dtw->hruler);
420 g_signal_connect (G_OBJECT (eventbox), "button_press_event", G_CALLBACK (sp_dt_hruler_event), dtw);
421 g_signal_connect (G_OBJECT (eventbox), "button_release_event", G_CALLBACK (sp_dt_hruler_event), dtw);
422 g_signal_connect (G_OBJECT (eventbox), "motion_notify_event", G_CALLBACK (sp_dt_hruler_event), dtw);
426 dtw->canvas_tbl = gtk_grid_new();
428 gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), dtw->guides_lock, 0, 0, 1, 1);
429 gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), eventbox, 1, 0, 1, 1);
432 dtw->canvas_tbl = gtk_table_new(3, 3, FALSE);
434 gtk_table_attach(GTK_TABLE(dtw->canvas_tbl),
435 dtw->guides_lock,
439 gtk_table_attach(GTK_TABLE(dtw->canvas_tbl),
445 g_signal_connect (G_OBJECT (dtw->guides_lock), "toggled", G_CALLBACK (sp_update_guides_lock), dtw);
446 gtk_box_pack_start( GTK_BOX(dtw->hbox), tbl, TRUE, TRUE, 1 );
450 dtw->vruler = sp_ruler_new(GTK_ORIENTATION_VERTICAL);
453 dtw->vruler_box = eventbox;
454 sp_ruler_set_unit (SP_RULER (dtw->vruler), pt);
455 gtk_widget_set_tooltip_text (dtw->vruler_box, gettext(pt->name_plural.c_str()));
456 gtk_container_add (GTK_CONTAINER (eventbox), GTK_WIDGET (dtw->vruler));
459 gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), eventbox, 0, 1, 1, 1);
461 gtk_table_attach(GTK_TABLE (dtw->canvas_tbl),
468 g_signal_connect (G_OBJECT (eventbox), "button_press_event", G_CALLBACK (sp_dt_vruler_event), dtw);
469 g_signal_connect (G_OBJECT (eventbox), "button_release_event", G_CALLBACK (sp_dt_vruler_event), dtw);
470 g_signal_connect (G_OBJECT (eventbox), "motion_notify_event", G_CALLBACK (sp_dt_vruler_event), dtw);
473 dtw->hadj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0));
479 dtw->hscrollbar = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (dtw->hadj));
480 gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), dtw->hscrollbar, 1, 2, 1, 1);
481 dtw->vscrollbar_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
483 dtw->hscrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (dtw->hadj));
484 gtk_table_attach(GTK_TABLE (dtw->canvas_tbl), dtw->hscrollbar, 1, 2, 2, 3,
487 dtw->vscrollbar_box = gtk_vbox_new (FALSE, 0);
491 dtw->sticky_zoom = sp_button_new_from_data ( Inkscape::ICON_SIZE_DECORATION,
496 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dtw->sticky_zoom), prefs->getBool("/options/stickyzoom/value"));
497 gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->sticky_zoom, FALSE, FALSE, 0);
498 g_signal_connect (G_OBJECT (dtw->sticky_zoom), "toggled", G_CALLBACK (sp_dtw_sticky_zoom_toggled), dtw);
501 dtw->vadj = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0));
504 dtw->vscrollbar = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT(dtw->vadj));
506 dtw->vscrollbar = gtk_vscrollbar_new (GTK_ADJUSTMENT (dtw->vadj));
509 gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->vscrollbar, TRUE, TRUE, 0);
512 gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), dtw->vscrollbar_box, 2, 0, 1, 2);
514 gtk_table_attach(GTK_TABLE(dtw->canvas_tbl), dtw->vscrollbar_box, 2, 3, 0, 2,
522 SPAction *act = verb->get_action( Inkscape::ActionContext( dtw->viewwidget.view ) );
527 dtw->cms_adjust = sp_button_new_from_data( Inkscape::ICON_SIZE_DECORATION,
536 cms_adjust_set_sensitive( dtw, enabled );
540 sp_button_toggle_set_down( SP_BUTTON(dtw->cms_adjust), TRUE );
544 g_signal_connect_after( G_OBJECT(dtw->cms_adjust), "clicked", G_CALLBACK(cms_adjust_toggled), dtw );
546 cms_adjust_set_sensitive(dtw, FALSE);
550 gtk_grid_attach( GTK_GRID(dtw->canvas_tbl), dtw->cms_adjust, 2, 2, 1, 1);
552 gtk_table_attach( GTK_TABLE(dtw->canvas_tbl), dtw->cms_adjust, 2, 3, 2, 3,
562 watcher->add(dtw);
566 dtw->canvas = SP_CANVAS(SPCanvas::createAA());
568 dtw->canvas->_enable_cms_display_adj = prefs->getBool("/options/displayprofile/enable");
570 gtk_widget_set_can_focus (GTK_WIDGET (dtw->canvas), TRUE);
572 sp_ruler_add_track_widget (SP_RULER(dtw->hruler), GTK_WIDGET(dtw->canvas));
573 sp_ruler_add_track_widget (SP_RULER(dtw->vruler), GTK_WIDGET(dtw->canvas));
577 GtkStyleContext *style_context = gtk_widget_get_style_context(GTK_WIDGET(dtw->canvas));
589 GtkStyle *style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(dtw->canvas)));
591 gtk_widget_set_style (GTK_WIDGET (dtw->canvas), style);
594 g_signal_connect (G_OBJECT (dtw->canvas), "event", G_CALLBACK (sp_desktop_widget_event), dtw);
597 gtk_widget_set_hexpand(GTK_WIDGET(dtw->canvas), TRUE);
598 gtk_widget_set_vexpand(GTK_WIDGET(dtw->canvas), TRUE);
599 gtk_grid_attach(GTK_GRID(dtw->canvas_tbl), GTK_WIDGET(dtw->canvas), 1, 1, 1, 1);
601 gtk_table_attach (GTK_TABLE (dtw->canvas_tbl), GTK_WIDGET(dtw->canvas), 1, 2, 1, 2, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), 0, 0);
610 dtw->dock = new Inkscape::UI::Widget::Dock();
618 paned->pack1(*Glib::wrap(dtw->canvas_tbl));
619 paned->pack2(dtw->dock->getWidget(), Gtk::FILL);
638 gtk_widget_set_hexpand(GTK_WIDGET(dtw->canvas_tbl), TRUE);
639 gtk_widget_set_vexpand(GTK_WIDGET(dtw->canvas_tbl), TRUE);
640 gtk_grid_attach(GTK_GRID(tbl), GTK_WIDGET (dtw->canvas_tbl), 1, 1, 1, 1);
642 gtk_table_attach (GTK_TABLE (tbl), GTK_WIDGET (dtw->canvas_tbl), 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL),
647 dtw->selected_style = new Inkscape::UI::Widget::SelectedStyle(true);
648 GtkHBox *ss_ = dtw->selected_style->gobj();
649 gtk_box_pack_start (GTK_BOX (dtw->statusbar), GTK_WIDGET(ss_), FALSE, FALSE, 0);
651 gtk_box_pack_start(GTK_BOX(dtw->statusbar),
660 g_signal_connect (G_OBJECT (dtw->hadj), "value-changed", G_CALLBACK (sp_desktop_widget_adjustment_value_changed), dtw);
661 g_signal_connect (G_OBJECT (dtw->vadj), "value-changed", G_CALLBACK (sp_desktop_widget_adjustment_value_changed), dtw);
664 gtk_box_pack_end (GTK_BOX (dtw->statusbar), statusbar_tail, FALSE, FALSE, 0);
667 dtw->zoom_status = gtk_spin_button_new_with_range (log(SP_DESKTOP_ZOOM_MIN)/log(2), log(SP_DESKTOP_ZOOM_MAX)/log(2), 0.1);
668 gtk_widget_set_tooltip_text (dtw->zoom_status, _("Zoom"));
669 gtk_widget_set_size_request (dtw->zoom_status, STATUS_ZOOM_WIDTH, -1);
670 gtk_entry_set_width_chars (GTK_ENTRY (dtw->zoom_status), 6);
671 gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (dtw->zoom_status), FALSE);
672 gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (dtw->zoom_status), GTK_UPDATE_ALWAYS);
673 g_signal_connect (G_OBJECT (dtw->zoom_status), "input", G_CALLBACK (sp_dtw_zoom_input), dtw);
674 g_signal_connect (G_OBJECT (dtw->zoom_status), "output", G_CALLBACK (sp_dtw_zoom_output), dtw);
675 g_object_set_data (G_OBJECT (dtw->zoom_status), "dtw", dtw->canvas);
676 g_signal_connect (G_OBJECT (dtw->zoom_status), "focus-in-event", G_CALLBACK (spinbutton_focus_in), dtw->zoom_status);
677 g_signal_connect (G_OBJECT (dtw->zoom_status), "key-press-event", G_CALLBACK (spinbutton_keypress), dtw->zoom_status);
678 dtw->zoom_update = g_signal_connect (G_OBJECT (dtw->zoom_status), "value_changed", G_CALLBACK (sp_dtw_zoom_value_changed), dtw);
679 dtw->zoom_update = g_signal_connect (G_OBJECT (dtw->zoom_status), "populate_popup", G_CALLBACK (sp_dtw_zoom_populate_popup), dtw);
683 dtw->coord_status = gtk_grid_new();
684 gtk_grid_set_row_spacing(GTK_GRID(dtw->coord_status), 0);
685 gtk_grid_set_column_spacing(GTK_GRID(dtw->coord_status), 2);
687 gtk_grid_attach(GTK_GRID(dtw->coord_status),
691 dtw->coord_status = gtk_table_new(5, 2, FALSE);
692 gtk_table_set_row_spacings(GTK_TABLE(dtw->coord_status), 0);
693 gtk_table_set_col_spacings(GTK_TABLE(dtw->coord_status), 2);
694 gtk_table_attach(GTK_TABLE(dtw->coord_status),
701 gtk_container_add (GTK_CONTAINER (eventbox), dtw->coord_status);
709 gtk_grid_attach(GTK_GRID(dtw->coord_status), label_x, 1, 0, 1, 1);
710 gtk_grid_attach(GTK_GRID(dtw->coord_status), label_y, 1, 1, 1, 1);
714 gtk_table_attach(GTK_TABLE(dtw->coord_status), label_x, 1,2, 0,1, GTK_FILL, GTK_FILL, 0, 0);
715 gtk_table_attach(GTK_TABLE(dtw->coord_status), label_y, 1,2, 1,2, GTK_FILL, GTK_FILL, 0, 0);
718 dtw->coord_status_x = gtk_label_new(NULL);
719 dtw->coord_status_y = gtk_label_new(NULL);
720 gtk_label_set_markup( GTK_LABEL(dtw->coord_status_x), "<tt> 0.00 </tt>" );
721 gtk_label_set_markup( GTK_LABEL(dtw->coord_status_y), "<tt> 0.00 </tt>" );
726 gtk_widget_set_halign(dtw->coord_status_x, GTK_ALIGN_END);
727 gtk_widget_set_halign(dtw->coord_status_y, GTK_ALIGN_END);
728 gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->coord_status_x, 2, 0, 1, 1);
729 gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->coord_status_y, 2, 1, 1, 1);
730 gtk_grid_attach(GTK_GRID(dtw->coord_status), label_z, 3, 0, 1, 2);
731 gtk_grid_attach(GTK_GRID(dtw->coord_status), dtw->zoom_status, 4, 0, 1, 2);
733 gtk_misc_set_alignment (GTK_MISC(dtw->coord_status_x), 1.0, 0.5);
734 gtk_misc_set_alignment (GTK_MISC(dtw->coord_status_y), 1.0, 0.5);
735 gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_x, 2,3, 0,1, GTK_FILL, GTK_FILL, 0, 0);
736 gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_y, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0);
737 gtk_table_attach(GTK_TABLE(dtw->coord_status), label_z, 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0);
738 gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->zoom_status, 4,5, 0,2, GTK_FILL, GTK_FILL, 0, 0);
741 sp_set_font_size_smaller (dtw->coord_status);
744 dtw->layer_selector = new Inkscape::Widgets::LayerSelector(NULL);
746 dtw->layer_selector->reference();
747 //dtw->layer_selector->set_size_request(-1, SP_ICON_SIZE_BUTTON);
748 gtk_box_pack_start(GTK_BOX(dtw->statusbar), GTK_WIDGET(dtw->layer_selector->gobj()), FALSE, FALSE, 1);
750 dtw->_tracker = ege_color_prof_tracker_new(GTK_WIDGET(dtw->layer_selector->gobj()));
757 dtw->canvas->_cms_key = id;
758 enabled = !dtw->canvas->_cms_key.empty();
759 cms_adjust_set_sensitive( dtw, enabled );
762 g_signal_connect( G_OBJECT(dtw->_tracker), "changed", G_CALLBACK(sp_dtw_color_profile_event), dtw );
764 dtw->select_status_eventbox = gtk_event_box_new ();
765 dtw->select_status = gtk_label_new (NULL);
766 gtk_label_set_ellipsize (GTK_LABEL(dtw->select_status), PANGO_ELLIPSIZE_END);
769 gtk_widget_set_halign(dtw->select_status, GTK_ALIGN_START);
771 gtk_misc_set_alignment (GTK_MISC (dtw->select_status), 0.0, 0.5);
774 gtk_widget_set_size_request (dtw->select_status, 1, -1);
776 gtk_label_set_markup (GTK_LABEL (dtw->select_status), _("<b>Welcome to Inkscape!</b> Use shape or freehand tools to create objects; use selector (arrow) to move or transform them."));
778 gtk_container_add (GTK_CONTAINER (dtw->select_status_eventbox), dtw->select_status);
780 gtk_box_pack_start(GTK_BOX(dtw->statusbar),
784 gtk_box_pack_start (GTK_BOX (dtw->statusbar), gtk_hbox_new(FALSE, 0), FALSE, FALSE, 2);
786 gtk_box_pack_start (GTK_BOX (dtw->statusbar), dtw->select_status_eventbox, TRUE, TRUE, 0);
788 gtk_widget_show_all (dtw->vbox);
790 gtk_widget_grab_focus (GTK_WIDGET(dtw->canvas));
796 AppearTimeTracker *tracker = new AppearTimeTracker(overallTimer, GTK_WIDGET(dtw), "first SPDesktopWidget");
806 g_signal_connect (G_OBJECT (dtw->canvas_tbl),
809 dtw);
817 SPDesktopWidget *dtw = SP_DESKTOP_WIDGET (object);
819 if (dtw == NULL) {
823 UXManager::getInstance()->delTrack(dtw);
825 if (dtw->desktop) {
827 watcher->remove(dtw);
829 g_signal_handlers_disconnect_by_func(G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK(sp_dtw_zoom_input), dtw);
830 g_signal_handlers_disconnect_by_func(G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK(sp_dtw_zoom_output), dtw);
831 g_signal_handlers_disconnect_matched (G_OBJECT (dtw->zoom_status), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, dtw->zoom_status);
832 g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK (sp_dtw_zoom_value_changed), dtw);
833 g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->zoom_status), (gpointer) G_CALLBACK (sp_dtw_zoom_populate_popup), dtw);
834 g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->canvas), (gpointer) G_CALLBACK (sp_desktop_widget_event), dtw);
835 g_signal_handlers_disconnect_by_func (G_OBJECT (dtw->canvas_tbl), (gpointer) G_CALLBACK (canvas_tbl_size_allocate), dtw);
838 dtw->layer_selector->setDesktop(NULL);
839 dtw->layer_selector->unreference();
840 INKSCAPE.remove_desktop (dtw->desktop); // clears selection too
841 dtw->modified_connection.disconnect();
842 dtw->desktop->destroy();
843 Inkscape::GC::release (dtw->desktop);
844 dtw->desktop = NULL;
847 dtw->modified_connection.~connection();
945 SPDesktopWidget *dtw = SP_DESKTOP_WIDGET (widget);
959 Geom::Rect const area = dtw->desktop->get_display_area();
960 double zoom = dtw->desktop->current_zoom();
966 if (SP_BUTTON_IS_DOWN(dtw->sticky_zoom)) {
968 Geom::Rect newarea = dtw->desktop->get_display_area();
974 dtw->desktop->zoom_absolute(area.midpoint()[Geom::X], area.midpoint()[Geom::Y], zoom);
978 dtw->desktop->show_dialogs();
995 SPDesktopWidget *dtw = SP_DESKTOP_WIDGET (widget);
1000 Geom::Rect d = Geom::Rect::from_xywh(Geom::Point(0,0), (dtw->desktop->doc())->getDimensions());
1004 dtw->desktop->set_display_area (d.left(), d.top(), d.right(), d.bottom(), 10);
1006 dtw->updateNamedview();
1028 sp_desktop_widget_event (GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dtw)
1032 gtk_widget_grab_focus (GTK_WIDGET(dtw->canvas));
1037 sp_canvas_arena_set_sticky (SP_CANVAS_ARENA (dtw->desktop->drawing), TRUE);
1039 sp_canvas_arena_set_sticky (SP_CANVAS_ARENA (dtw->desktop->drawing), FALSE);
1052 && !dtw->canvas->_current_item) {
1053 return sp_desktop_root_handler (NULL, event, dtw->desktop);
1062 void sp_dtw_color_profile_event(EgeColorProfTracker */*tracker*/, SPDesktopWidget *dtw)
1065 GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(dtw));
1066 GdkWindow *window = gtk_widget_get_window(gtk_widget_get_toplevel(GTK_WIDGET(dtw)));
1071 dtw->canvas->_cms_key = id;
1072 dtw->requestCanvasUpdate();
1073 enabled = !dtw->canvas->_cms_key.empty();
1074 cms_adjust_set_sensitive( dtw, enabled );
1077 void sp_dtw_color_profile_event(EgeColorProfTracker */*tracker*/, SPDesktopWidget * /*dtw*/)
1084 SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(data);
1086 bool down = SP_BUTTON_IS_DOWN(dtw->guides_lock);
1088 SPDocument *doc = dtw->desktop->getDocument();
1089 SPNamedView *nv = dtw->desktop->getNamedView();
1096 dtw->setMessage (Inkscape::NORMAL_MESSAGE, _("Locked all guides"));
1098 dtw->setMessage (Inkscape::NORMAL_MESSAGE, _("Unlocked all guides"));
1106 SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(data);
1108 bool down = SP_BUTTON_IS_DOWN(dtw->cms_adjust);
1109 if ( down != dtw->canvas->_enable_cms_display_adj ) {
1110 dtw->canvas->_enable_cms_display_adj = down;
1111 dtw->requestCanvasUpdate();
1115 dtw->setMessage (Inkscape::NORMAL_MESSAGE, _("Color-managed display is <b>enabled</b> in this window"));
1117 dtw->setMessage (Inkscape::NORMAL_MESSAGE, _("Color-managed display is <b>disabled</b> in this window"));
1123 void cms_adjust_set_sensitive( SPDesktopWidget *dtw, bool enabled )
1127 SPAction *act = verb->get_action( Inkscape::ActionContext( dtw->viewwidget.view ) );
1132 gtk_widget_set_sensitive( dtw->cms_adjust, enabled );
1136 sp_dtw_desktop_activate (SPDesktopWidget */*dtw*/)
1142 sp_dtw_desktop_deactivate (SPDesktopWidget */*dtw*/)
1474 sp_desktop_widget_iconify(SPDesktopWidget *dtw)
1476 GtkWindow *topw = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(dtw->canvas)));
1478 if (dtw->desktop->is_iconified()) {
1487 sp_desktop_widget_maximize(SPDesktopWidget *dtw)
1489 GtkWindow *topw = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(dtw->canvas)));
1491 if (dtw->desktop->is_maximized()) {
1497 if (!dtw->desktop->is_iconified() && !dtw->desktop->is_fullscreen())
1502 dtw->getWindowGeometry(x, y, w, h);
1515 sp_desktop_widget_fullscreen(SPDesktopWidget *dtw)
1517 GtkWindow *topw = GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(dtw->canvas)));
1519 if (dtw->desktop->is_fullscreen()) {
1526 if (!dtw->desktop->is_iconified() && !dtw->desktop->is_maximized())
1530 dtw->getWindowGeometry(x, y, w, h);
1547 SPDesktopWidget *dtw = this;
1551 if (dtw->desktop->is_focusMode()) {
1553 } else if (dtw->desktop->is_fullscreen()) {
1560 gtk_widget_hide (dtw->menubar);
1562 gtk_widget_show_all (dtw->menubar);
1566 gtk_widget_hide (dtw->commands_toolbox);
1568 gtk_widget_show_all (dtw->commands_toolbox);
1572 gtk_widget_hide (dtw->snap_toolbox);
1574 gtk_widget_show_all (dtw->snap_toolbox);
1578 gtk_widget_hide (dtw->aux_toolbox);
1582 ToolboxFactory::showAuxToolbox(dtw->aux_toolbox);
1586 gtk_widget_hide (dtw->tool_toolbox);
1588 gtk_widget_show_all (dtw->tool_toolbox);
1592 gtk_widget_hide (dtw->statusbar);
1594 gtk_widget_show_all (dtw->statusbar);
1598 gtk_widget_hide ( GTK_WIDGET(dtw->panels->gobj()) );
1600 gtk_widget_show_all( GTK_WIDGET(dtw->panels->gobj()) );
1604 gtk_widget_hide (dtw->hscrollbar);
1605 gtk_widget_hide (dtw->vscrollbar_box);
1606 gtk_widget_hide ( dtw->cms_adjust );
1608 gtk_widget_show_all (dtw->hscrollbar);
1609 gtk_widget_show_all (dtw->vscrollbar_box);
1610 gtk_widget_show_all( dtw->cms_adjust );
1614 gtk_widget_hide (dtw->guides_lock);
1615 gtk_widget_hide (dtw->hruler);
1616 gtk_widget_hide (dtw->vruler);
1618 gtk_widget_show_all (dtw->guides_lock);
1619 gtk_widget_show_all (dtw->hruler);
1620 gtk_widget_show_all (dtw->vruler);
1732 SPDesktopWidget* dtw = SPDesktopWidget::createInstance(namedview);
1734 return SP_VIEW_WIDGET(dtw);
1739 SPDesktopWidget *dtw = static_cast<SPDesktopWidget*>(g_object_new(SP_TYPE_DESKTOP_WIDGET, NULL));
1741 dtw->dt2r = 1. / namedview->display_units->factor;
1743 dtw->ruler_origin = Geom::Point(0,0); //namedview->gridorigin; Why was the grid origin used here?
1745 dtw->desktop = new SPDesktop();
1746 dtw->stub = new SPDesktopWidget::WidgetStub (dtw);
1747 dtw->desktop->init (namedview, dtw->canvas, dtw->stub);
1748 INKSCAPE.add_desktop (dtw->desktop);
1752 init_avoided_shape_geometry(dtw->desktop);
1754 dtw->selected_style->setDesktop(dtw->desktop);
1757 sp_desktop_widget_update_rulers (dtw);
1758 sp_button_toggle_set_down( SP_BUTTON(dtw->guides_lock), namedview->lockguides );
1760 sp_view_widget_set_view (SP_VIEW_WIDGET (dtw), dtw->desktop);
1763 dtw->modified_connection = namedview->connectModified(sigc::mem_fun(*dtw, &SPDesktopWidget::namedviewModified));
1765 dtw->layer_selector->setDesktop(dtw->desktop);
1767 dtw->menubar = sp_ui_main_menubar (dtw->desktop);
1768 gtk_widget_show_all (dtw->menubar);
1769 gtk_box_pack_start (GTK_BOX (dtw->vbox), dtw->menubar, FALSE, FALSE, 0);
1771 dtw->layoutWidgets();
1774 toolboxes.push_back(dtw->tool_toolbox);
1775 toolboxes.push_back(dtw->aux_toolbox);
1776 toolboxes.push_back(dtw->commands_toolbox);
1777 toolboxes.push_back(dtw->snap_toolbox);
1779 dtw->panels->setDesktop( dtw->desktop );
1781 UXManager::getInstance()->addTrack(dtw);
1782 UXManager::getInstance()->connectToDesktop( toolboxes, dtw->desktop );
1784 return dtw;
1789 sp_desktop_widget_update_rulers (SPDesktopWidget *dtw)
1791 Geom::Rect viewbox = dtw->desktop->get_display_area();
1793 double lower_x = dtw->dt2r * (viewbox.left() - dtw->ruler_origin[Geom::X]);
1794 double upper_x = dtw->dt2r * (viewbox.right() - dtw->ruler_origin[Geom::X]);
1795 sp_ruler_set_range(SP_RULER(dtw->hruler),
1800 double lower_y = dtw->dt2r * (viewbox.bottom() - dtw->ruler_origin[Geom::Y]);
1801 double upper_y = dtw->dt2r * (viewbox.top() - dtw->ruler_origin[Geom::Y]);
1802 sp_ruler_set_range(SP_RULER(dtw->vruler),
1863 sp_desktop_widget_adjustment_value_changed (GtkAdjustment */*adj*/, SPDesktopWidget *dtw)
1865 if (dtw->update)
1868 dtw->update = 1;
1870 dtw->canvas->scrollTo(gtk_adjustment_get_value(dtw->hadj),
1871 gtk_adjustment_get_value(dtw->vadj), FALSE);
1872 sp_desktop_widget_update_rulers (dtw);
1875 //sp_box3d_context_update_lines(dtw->desktop->event_context);
1876 if (SP_IS_BOX3D_CONTEXT(dtw->desktop->event_context)) {
1877 SP_BOX3D_CONTEXT(dtw->desktop->event_context)->_vpdrag->updateLines();
1880 dtw->update = 0;
1947 SPDesktopWidget *dtw = SP_DESKTOP_WIDGET (data);
1948 SPDesktop *desktop = dtw->desktop;
1951 g_signal_handler_block (spin, dtw->zoom_update);
1953 g_signal_handler_unblock (spin, dtw->zoom_update);
2091 SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(data);
2093 prefs->setBool("/options/stickyzoom/value", SP_BUTTON_IS_DOWN(dtw->sticky_zoom));
2098 sp_desktop_widget_update_zoom (SPDesktopWidget *dtw)
2100 GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(dtw->zoom_status));
2102 g_signal_handlers_block_by_func (G_OBJECT (dtw->zoom_status), (gpointer)G_CALLBACK (sp_dtw_zoom_value_changed), dtw);
2103 gtk_spin_button_set_value (GTK_SPIN_BUTTON (dtw->zoom_status), log(dtw->desktop->current_zoom()) / log(2));
2104 gtk_widget_queue_draw(GTK_WIDGET(dtw->zoom_status));
2107 g_signal_handlers_unblock_by_func (G_OBJECT (dtw->zoom_status), (gpointer)G_CALLBACK (sp_dtw_zoom_value_changed), dtw);
2111 sp_desktop_widget_toggle_rulers (SPDesktopWidget *dtw)
2114 if (gtk_widget_get_visible (dtw->guides_lock)) {
2115 gtk_widget_hide (dtw->guides_lock);
2116 gtk_widget_hide (dtw->hruler);
2117 gtk_widget_hide (dtw->vruler);
2118 prefs->setBool(dtw->desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state", false);
2120 gtk_widget_show_all (dtw->guides_lock);
2121 gtk_widget_show_all (dtw->hruler);
2122 gtk_widget_show_all (dtw->vruler);
2123 prefs->setBool(dtw->desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state", true);
2128 sp_desktop_widget_toggle_scrollbars (SPDesktopWidget *dtw)
2131 if (gtk_widget_get_visible (dtw->hscrollbar)) {
2132 gtk_widget_hide (dtw->hscrollbar);
2133 gtk_widget_hide (dtw->vscrollbar_box);
2134 gtk_widget_hide ( dtw->cms_adjust );
2135 prefs->setBool(dtw->desktop->is_fullscreen() ? "/fullscreen/scrollbars/state" : "/window/scrollbars/state", false);
2137 gtk_widget_show_all (dtw->hscrollbar);
2138 gtk_widget_show_all (dtw->vscrollbar_box);
2139 gtk_widget_show_all( dtw->cms_adjust );
2140 prefs->setBool(dtw->desktop->is_fullscreen() ? "/fullscreen/scrollbars/state" : "/window/scrollbars/state", true);
2144 bool sp_desktop_widget_color_prof_adj_enabled( SPDesktopWidget *dtw )
2146 return gtk_widget_get_sensitive( dtw->cms_adjust ) &&
2147 SP_BUTTON_IS_DOWN(dtw->cms_adjust) ;
2150 void sp_desktop_widget_toggle_color_prof_adj( SPDesktopWidget *dtw )
2152 if ( gtk_widget_get_sensitive( dtw->cms_adjust ) ) {
2153 if ( SP_BUTTON_IS_DOWN(dtw->cms_adjust) ) {
2154 sp_button_toggle_set_down( SP_BUTTON(dtw->cms_adjust), FALSE );
2156 sp_button_toggle_set_down( SP_BUTTON(dtw->cms_adjust), TRUE );
2161 void sp_desktop_widget_toggle_guides_lock( SPDesktopWidget *dtw )
2163 if ( SP_BUTTON_IS_DOWN(dtw->guides_lock) ) {
2164 sp_button_toggle_set_down( SP_BUTTON(dtw->guides_lock), FALSE );
2166 sp_button_toggle_set_down( SP_BUTTON(dtw->guides_lock), TRUE );
2171 sp_spw_toggle_menubar (SPDesktopWidget *dtw, bool is_fullscreen)
2174 if (gtk_widget_get_visible (dtw->menubar)) {
2175 gtk_widget_hide (dtw->menubar);
2178 gtk_widget_show_all (dtw->menubar);
2202 sp_desktop_widget_update_scrollbars (SPDesktopWidget *dtw, double scale)
2204 if (!dtw) return;
2205 if (dtw->update) return;
2206 dtw->update = 1;
2209 SPDocument *doc = dtw->desktop->doc();
2224 Geom::Rect viewbox = dtw->canvas->getViewbox();
2229 set_adjustment(dtw->hadj, carea.min()[Geom::X], carea.max()[Geom::X],
2233 gtk_adjustment_set_value(dtw->hadj, viewbox.min()[Geom::X]);
2235 set_adjustment(dtw->vadj, carea.min()[Geom::Y], carea.max()[Geom::Y],
2239 gtk_adjustment_set_value(dtw->vadj, viewbox.min()[Geom::Y]);
2241 dtw->update = 0;