void FontSubstitution::show(Glib::ustring out, GSList *l) { Gtk::MessageDialog warning(_("\nSome fonts are not available and have been substituted."), false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); warning.set_resizable(true); warning.set_title(_("Font substitution")); GtkWidget *dlg = GTK_WIDGET(warning.gobj()); sp_transientize(dlg); Gtk::TextView * textview = new Gtk::TextView(); textview->set_editable(false); textview->set_wrap_mode(Gtk::WRAP_WORD); textview->show(); textview->get_buffer()->set_text(_(out.c_str())); Gtk::ScrolledWindow * scrollwindow = new Gtk::ScrolledWindow(); scrollwindow->add(*textview); scrollwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrollwindow->set_shadow_type(Gtk::SHADOW_IN); scrollwindow->set_size_request(0, 100); scrollwindow->show(); Gtk::CheckButton *cbSelect = new Gtk::CheckButton(); cbSelect->set_label(_("Select all the affected items")); cbSelect->set_active(true); cbSelect->show(); Gtk::CheckButton *cbWarning = new Gtk::CheckButton(); cbWarning->set_label(_("Don't show this warning again")); cbWarning->show(); #if GTK_CHECK_VERSION(3,0,0) Gtk::Box * box = warning.get_content_area(); #else Gtk::Box * box = warning.get_vbox(); #endif box->set_spacing(2); box->pack_start(*scrollwindow, true, true, 4); box->pack_start(*cbSelect, false, false, 0); box->pack_start(*cbWarning, false, false, 0); warning.run(); if (cbWarning->get_active()) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); prefs->setInt("/options/font/substitutedlg", 0); } if (cbSelect->get_active()) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; Inkscape::Selection *selection = sp_desktop_selection (desktop); selection->clear(); selection->setList(l); } }
logTextview::logTextview() { Gtk::TextView *lt = this; lt->set_flags(Gtk::CAN_FOCUS); lt->set_editable(false); lt->set_cursor_visible(false); lt->set_pixels_above_lines(0); lt->set_pixels_below_lines(0); lt->set_pixels_inside_wrap(0); lt->set_left_margin(0); lt->set_right_margin(0); lt->set_indent(5); lt->set_wrap_mode(Gtk::WRAP_WORD); lt->set_justification(Gtk::JUSTIFY_LEFT); lt->show(); writeLog("Log begins .."); }
int textview___::proc__(std::deque<Glib::ustring>* p,char*buf,long siz,char**addr_ret,void*shangji) { char sdz=0; if((*p)[0]=="插入"){ if(siz==-1)return 1; sdz='i'; }else if((*p)[0]==name__()){ if(siz==-1)return 1; sdz='t'; }else return 0; if(p->size()<=2){ d_(sh_,err_show_buzu_,p); return 1; } switch(sdz){ case'i': return insert__(p,0); case't': { Gtk::TextView* tv; char sdz1=0; const Glib::ustring& p1=(*p)[1]; if(p1=="剪切") sdz1='x'; else if(p1=="复制") sdz1='c'; else if(p1=="粘贴") sdz1='v'; else if(p1=="已修改") sdz1='m'; else if(p1=="内容") sdz1=' '; else if(p1=="焦点") sdz1='.'; else if(p1=="不可编辑") sdz1='e'; else if(p1=="光标位置") sdz1='p'; else if(p1=="光标行列") sdz1='l'; else if(p1=="选择") sdz1='S'; else if(p1=="插入") return insert__(p,1); else{ switch(sdz){ case't': d_(sh_,err_show_buzhichi_,2,p,1); return 1; } } tv=tv__(p,2); if(!tv) return 1; Glib::RefPtr < Gtk::TextBuffer > tb = tv->get_buffer(); switch(sdz1){ case'x': case'c': case'v': { Glib::RefPtr<Gtk::Clipboard> cb = Gtk::Clipboard::get(); switch(sdz1){ case'x': tb->cut_clipboard(cb); break; case'c': tb->copy_clipboard(cb); break; case'v': tb->paste_clipboard(cb); break; } break; } case'm': if(p->size()>3){ const Glib::ustring&s=(*p)[3]; if(s=="侦听"){ control___* ctl=Gtk::manage(new control___(sh_,d_,(*p)[0],(*p)[2],p1)); if(p->size()>4) ctl->code__((*p)[4]); tb->signal_modified_changed().connect(sigc::mem_fun(*ctl,&control___::modified_changed__),false); }else tb->set_modified(d_(sh_,bool_,s.c_str())); }else l2s__(tb->get_modified(),buf); break; case' ': if(p->size()>3) tb->set_text((*p)[3]); else *addr_ret=dup__(tb->get_text().c_str()); break; case'.': tv->grab_focus(); break; case'e': if(p->size()>3) tv->set_editable(d_(sh_,bool_,(*p)[3].c_str())); else tv->set_editable(false); break; case'p': case'l': { Gtk::TextIter ti=tb->get_iter_at_mark(tb->get_mark("insert")); if(sdz1=='l'){ if(p->size()<=3) sprintf(buf,"%d,%d,",ti.get_line (),ti.get_line_offset ()); else{ int line_offset=ti.get_line_offset (); if(p->size()>3) ti.set_line (s2i_plus__((*p)[3],ti.get_line ())); if(p->size()>4) ti.set_line_offset (s2i_plus__((*p)[4],line_offset)); tb->place_cursor(ti); } }else{ if(p->size()>3){ ti.set_offset (s2i_plus__((*p)[3],ti.get_offset ())); tb->place_cursor(ti); }else l2s__(ti.get_offset (),buf); } break; } case'S': if(p->size()>4){ Gtk::TextIter ti1=tb->begin(),ti2=tb->begin(); ti1.set_offset(s2i__((*p)[3])); ti2.set_offset(s2i__((*p)[4])); tb->select_range(ti1,ti2); } break; } break; } } return 1; }
void ResViewerViewImpl::setFileContentsByName(std::map<std::string, Glib::RefPtr<Gtk::TextBuffer> > FileContents) { Glib::ustring ExistingTabSelection = ""; if (mp_Notebook->get_current()) ExistingTabSelection = mp_Notebook->get_current()->get_tab_label_text(); int TabToSelect = 0; while (mp_Notebook->get_n_pages() > 1) mp_Notebook->remove_page(1); for (std::map<std::string, Glib::RefPtr<Gtk::TextBuffer> >::iterator it = FileContents.begin(); it != FileContents.end(); ++it) { Gtk::TextView* TextView = Gtk::manage(new Gtk::TextView(it->second)); TextView->set_editable(false); TextView->set_visible(true); Gtk::ScrolledWindow* Win = Gtk::manage(new Gtk::ScrolledWindow()); Win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); Win->set_visible(true); Win->set_shadow_type(Gtk::SHADOW_ETCHED_IN); Win->add(*TextView); Gtk::Label* TabLabel = Gtk::manage(new Gtk::Label(it->first)); Gtk::Label* MenuLabel = Gtk::manage(new Gtk::Label(it->first, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER)); Gtk::Button* SingleGNUplotButton = Gtk::manage(new Gtk::Button( _("Plot file with GNUplot\n(All-in-one window)"))); Gtk::Button* MultiGNUplotButton = Gtk::manage(new Gtk::Button( _("Plot file with GNUplot\n(Multiple windows)"))); Gtk::VBox* RightButtonsBox = Gtk::manage(new Gtk::VBox()); RightButtonsBox->pack_start(*SingleGNUplotButton, Gtk::PACK_SHRINK); RightButtonsBox->pack_start(*MultiGNUplotButton, Gtk::PACK_SHRINK, 5); RightButtonsBox->show_all_children(true); RightButtonsBox->set_visible(true); #if WIN32 SingleGNUplotButton->set_sensitive(false); MultiGNUplotButton->set_sensitive(false); #else if (ViewWithGNUplot::IsGNUplotAvailable()) { SingleGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr< Gtk::TextBuffer>, std::string, std::string, std::string, bool>( sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked), (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep, m_CommentChar, true)); SingleGNUplotButton->set_sensitive(true); MultiGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr< Gtk::TextBuffer>, std::string, std::string, std::string, bool>( sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked), (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep, m_CommentChar, false)); MultiGNUplotButton->set_sensitive(true); } else { SingleGNUplotButton->set_sensitive(false); MultiGNUplotButton->set_sensitive(false); } #endif Gtk::HBox* MainHBox = Gtk::manage(new Gtk::HBox()); MainHBox->pack_start(*Win, Gtk::PACK_EXPAND_WIDGET, 5); MainHBox->pack_start(*RightButtonsBox, Gtk::PACK_SHRINK, 5); MainHBox->set_border_width(8); MainHBox->set_visible(true); int PageNum = mp_Notebook->append_page(*MainHBox, *TabLabel, *MenuLabel); if (it->first == ExistingTabSelection) TabToSelect = PageNum; mp_Notebook->set_tab_reorderable(*Win, true); } mp_Notebook->set_current_page(TabToSelect); }
aboutDialog::aboutDialog() { Gtk::Dialog *ad = this; Gtk::Button *okbutton = Gtk::manage(new class Gtk::Button("ok")); Gtk::Label *aboutLabel = Gtk::manage(new class Gtk::Label( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + ", build " + GPD->sBUILD() )); Gtk::TextView *textview = Gtk::manage(new class Gtk::TextView()); Gtk::ScrolledWindow *scrolledwindow = Gtk::manage(new class Gtk::ScrolledWindow()); Gtk::VBox *vbox = Gtk::manage(new class Gtk::VBox(false, 0)); okbutton->set_flags(Gtk::CAN_FOCUS); okbutton->set_relief(Gtk::RELIEF_NORMAL); ad->get_action_area()->property_layout_style().set_value(Gtk::BUTTONBOX_END); ad->set_default_size(300, 200); aboutLabel->set_alignment(0.5,0.5); aboutLabel->set_padding(0,0); aboutLabel->set_justify(Gtk::JUSTIFY_LEFT); aboutLabel->set_line_wrap(false); aboutLabel->set_use_markup(false); aboutLabel->set_selectable(false); textview->set_flags(Gtk::CAN_FOCUS); textview->set_editable(true); textview->set_cursor_visible(true); textview->set_pixels_above_lines(0); textview->set_pixels_below_lines(0); textview->set_pixels_inside_wrap(0); textview->set_left_margin(0); textview->set_right_margin(0); textview->set_indent(0); textview->set_wrap_mode(Gtk::WRAP_NONE); textview->set_justification(Gtk::JUSTIFY_LEFT); using namespace std; string text; text += "btg Copyright (C) 2005 Michael Wojciechowski."; text += GPD->sNEWLINE(); text += "This program is free software; you can redistribute it and/or modify"; text += GPD->sNEWLINE(); text += "it under the terms of the GNU General Public License as published by "; text += GPD->sNEWLINE(); text += "the Free Software Foundation; either version 2 of the License, or "; text += GPD->sNEWLINE(); text += "(at your option) any later version."; text += GPD->sNEWLINE(); text += "This program is distributed in the hope that it will be useful, "; text += GPD->sNEWLINE(); text += "but WITHOUT ANY WARRANTY; without even the implied warranty of "; text += GPD->sNEWLINE(); text += "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "; text += GPD->sNEWLINE(); text += "GNU General Public License for more details."; text += GPD->sNEWLINE(); text += "You should have received a copy of the GNU General Public License "; text += GPD->sNEWLINE(); text += "along with this program; if not, write to the Free Software "; text += GPD->sNEWLINE(); text += "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"; text += GPD->sNEWLINE(); textview->get_buffer()->set_text(text); scrolledwindow->set_flags(Gtk::CAN_FOCUS); scrolledwindow->set_shadow_type(Gtk::SHADOW_IN); scrolledwindow->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); scrolledwindow->property_window_placement().set_value(Gtk::CORNER_TOP_LEFT); scrolledwindow->add(*textview); vbox->pack_start(*aboutLabel, Gtk::PACK_SHRINK, 0); vbox->pack_start(*scrolledwindow); ad->get_vbox()->set_homogeneous(false); ad->get_vbox()->set_spacing(0); ad->get_vbox()->pack_start(*vbox); //ad->set_title( "About " + GPD->sGUI_CLIENT() + " " + GPD->sVERSION() ); ad->set_title( GPD->sGUI_CLIENT() + " " + GPD->sVERSION() + " / About" ); ad->set_modal(true); ad->property_window_position().set_value(Gtk::WIN_POS_CENTER); ad->set_resizable(true); ad->property_destroy_with_parent().set_value(false); ad->set_has_separator(true); ad->add_action_widget(*okbutton, -5); okbutton->show(); aboutLabel->show(); textview->show(); scrolledwindow->show(); vbox->show(); okbutton->signal_clicked().connect(sigc::mem_fun(*this, &aboutDialog::on_ok_clicked)); // ad->show(); }