X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fwidget_defaults.cpp;h=b791ecf59d3ce8b7a6dc15ce00d3b3b6d8a79425;hb=c3ad95144d148602f672e95ddda1f18fc35502f8;hp=f7357326082aa295aa6c574125d51f0c2222b78a;hpb=02252941b29de64037116f4d37991a38d9ff0d94;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/widget_defaults.cpp b/synfig-studio/trunk/src/gtkmm/widget_defaults.cpp index f735732..b791ecf 100644 --- a/synfig-studio/trunk/src/gtkmm/widget_defaults.cpp +++ b/synfig-studio/trunk/src/gtkmm/widget_defaults.cpp @@ -2,19 +2,20 @@ /*! \file widget_defaults.cpp ** \brief Template File ** -** $Id: widget_defaults.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -75,14 +76,14 @@ public: synfigapp::Main::signal_bline_width_changed().connect(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw)); studio::App::signal_instance_selected().connect(sigc::hide(sigc::mem_fun(*this,&studio::Widget_Brush::queue_draw))); } - + bool - redraw(GdkEventExpose*bleh) + redraw(GdkEventExpose */*bleh*/) { Glib::RefPtr gc(Gdk::GC::create(get_window())); - + const int h(get_height()); - const int w(get_width()); + const int w(get_width()); float pixelsize(0); if(App::get_selected_canvas_view()) @@ -90,7 +91,7 @@ public: const RendDesc& rend_desc(App::get_selected_canvas_view()->get_canvas()->rend_desc()); pixelsize=synfigapp::Main::get_bline_width().get(Distance::SYSTEM_PIXELS,rend_desc); } - else + else { RendDesc rend_desc; pixelsize=synfigapp::Main::get_bline_width().get(Distance::SYSTEM_PIXELS,rend_desc); @@ -100,7 +101,7 @@ public: /* gc->set_rgb_fg_color(colorconv_synfig2gdk(synfigapp::Main::get_background_color())); - gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER); + gc->set_line_attributes(1,Gdk::LINE_SOLID,Gdk::CAP_BUTT,Gdk::JOIN_MITER); get_window()->draw_rectangle( gc, true, // Fill? @@ -108,7 +109,7 @@ public: w,h //w,h ); */ - + // Draw in the circle gc->set_rgb_fg_color(colorconv_synfig2gdk(synfigapp::Main::get_foreground_color())); gc->set_function(Gdk::COPY); @@ -122,8 +123,8 @@ public: round_to_int(pixelsize+0.6), 0, 360*64 - ); - + ); + return true; } @@ -132,10 +133,10 @@ public: { // const int x(static_cast(event->button.x)); const int y(static_cast(event->button.y)); - + const int h(get_height()); -// const int w(get_width()); - +// const int w(get_width()); + switch(event->type) { case GDK_MOTION_NOTIFY: @@ -144,7 +145,7 @@ public: if(event->button.button==1) // Left click { Distance dist(synfigapp::Main::get_bline_width()); - + if(yscroll.direction==GDK_SCROLL_UP) { dist+=DEFAULT_INCREMENT; @@ -181,7 +182,7 @@ public: default: break; } - + return false; } @@ -195,10 +196,10 @@ Widget_Defaults::Widget_Defaults() { //set_size_request(48,48+GRADIENT_HEIGHT+16); //set_size_request(48,-1); - + { Gtk::Table* subtable(manage(new Gtk::Table())); - + // Foreground Color widget_fg_color=manage(new Widget_Color()); widget_fg_color->show(); @@ -206,7 +207,7 @@ Widget_Defaults::Widget_Defaults() widget_fg_color->signal_clicked().connect(sigc::mem_fun(*this,&Widget_Defaults::on_fg_color_clicked)); subtable->attach(*widget_fg_color, 0, 2, 0, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0); tooltips_.set_tip(*widget_fg_color,_("Foreground Color")); - + // Background Color widget_bg_color=manage(new Widget_Color()); widget_bg_color->show(); @@ -216,7 +217,7 @@ Widget_Defaults::Widget_Defaults() tooltips_.set_tip(*widget_bg_color,_("Background Color")); Gtk::Image* icon; - + // Swap button Gtk::Button* button_swap(manage(new Gtk::Button())); button_swap->show(); @@ -243,7 +244,7 @@ Widget_Defaults::Widget_Defaults() subtable->attach(*button_reset, 0,1, 2, 3, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); tooltips_.set_tip(*button_reset,_("Reset Colors to Black and White")); - + attach(*subtable, 0, 1, 0, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 1, 1); subtable->set_size_request(36,36); subtable->set_homogeneous(true); @@ -257,7 +258,9 @@ Widget_Defaults::Widget_Defaults() widget_bline_width=manage(new Widget_Distance()); widget_bline_width->show(); + bline_width_refresh(); widget_bline_width->set_digits(2); + widget_bline_width->set_range(0,10000000); widget_bline_width->set_size_request(24,-1); widget_bline_width->signal_value_changed().connect(sigc::mem_fun(*this,&studio::Widget_Defaults::on_bline_width_changed)); attach(*widget_bline_width,1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0); @@ -277,7 +280,7 @@ Widget_Defaults::Widget_Defaults() widget_interpolation->set_param_desc( ParamDesc("interpolation") .set_hint("enum") - .add_enum_value(INTERPOLATION_TCB,"auto",_("TBC")) + .add_enum_value(INTERPOLATION_TCB,"auto",_("TCB")) .add_enum_value(INTERPOLATION_CONSTANT,"constant",_("Constant")) .add_enum_value(INTERPOLATION_HALT,"ease",_("Ease in/out")) .add_enum_value(INTERPOLATION_LINEAR,"linear",_("Linear")) @@ -313,7 +316,6 @@ Widget_Defaults::Widget_Defaults() fg_color_refresh(); bg_color_refresh(); gradient_refresh(); - bline_width_refresh(); blend_method_refresh(); opacity_refresh(); interpolation_refresh(); @@ -334,7 +336,7 @@ Widget_Defaults::Widget_Defaults() App::dialog_gradient->reset(); App::dialog_gradient->signal_edited().connect(sigc::mem_fun(synfigapp::Main::set_gradient)); } - + if(App::dialog_color) { App::dialog_color->set_color(synfigapp::Main::get_foreground_color()); @@ -343,7 +345,7 @@ Widget_Defaults::Widget_Defaults() } */ } - + Widget_Defaults::~Widget_Defaults() { } @@ -463,21 +465,21 @@ Widget_Defaults::redraw(GdkEventExpose*bleh) Glib::RefPtr gc(Gdk::GC::create(get_window())); const int h(get_height()); - const int w(get_width()); + const int w(get_width()); const int size=std::min(h-GRADIENT_HEIGHT,w); - + render_color_to_window(get_window(),Gdk::Rectangle(size/4,size/4,size/4*3-1,size/4*3-1),synfigapp::Main::get_background_color()); render_color_to_window(get_window(),Gdk::Rectangle(0,0,size/4*3-1,size/4*3-1),synfigapp::Main::get_foreground_color()); render_gradient_to_window(get_window(),Gdk::Rectangle(0,h-GRADIENT_HEIGHT,w,GRADIENT_HEIGHT-1),synfigapp::Main::get_gradient()); - + Glib::RefPtr layout(Pango::Layout::create(get_pango_context())); - + gc->set_rgb_fg_color(Gdk::Color("#FF0000")); - layout->set_text(synfigapp::Main::get_bline_width().get_string(2)); + layout->set_text(synfigapp::Main::get_bline_width().get_string(2)); layout->set_alignment(Pango::ALIGN_CENTER); layout->set_width(w/2); get_window()->draw_layout(gc, w*3/4, (h-GRADIENT_HEIGHT)-16, layout); @@ -492,7 +494,7 @@ Widget_Defaults::on_event(GdkEvent *event) const int y(static_cast(event->button.y)); const int h(get_height()); - const int w(get_width()); + const int w(get_width()); const int size=std::min(h-GRADIENT_HEIGHT,w); switch(event->type) @@ -538,7 +540,7 @@ Widget_Defaults::on_event(GdkEvent *event) if(x>size) // Left click on BLine Width { Distance dist(synfigapp::Main::get_bline_width()); - + if(yw/2) { // right click on bline width synfigapp::Main::set_bline_width(DEFAULT_WIDTH); } - + } } break; case GDK_SCROLL: { Distance dist(synfigapp::Main::get_bline_width()); - + if(event->scroll.direction==GDK_SCROLL_UP) { dist+=DEFAULT_INCREMENT; @@ -593,7 +595,7 @@ Widget_Defaults::on_event(GdkEvent *event) default: break; } - + return false; } */