From: Jürgen Vigna Date: Thu, 17 Aug 2000 15:20:30 +0000 (+0000) Subject: Marko's GNOME patch, some modifications to this, some fixes. X-Git-Tag: 1.6.10~22031 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=33f1a7576f909de4902546a9e67a454df7582139;p=features.git Marko's GNOME patch, some modifications to this, some fixes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@976 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/ChangeLog b/ChangeLog index 699e4884c8..4a5643a406 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2000-08-17 Juergen Vigna + + * src/frontends/gnome/Menubar_pimpl.C (openByName): put this function + in the implementation part. + (composeUIInfo): don't show optional menu-items. + + * src/lyxfunc.C (getStatus): use insets LyXText if the_locking_inset. + + * src/insets/insettext.C (UpdateLocal): call to LyXView::showState() + + * src/bufferview_funcs.C (CurrentState): fixed to show also the + text-state when in a text-inset. + + * src/frontends/kde/GUIRunTime_pimpl.C: include xforms for now. + +2000-08-17 Marko Vendelin + * src/frontends/gnome/FormIndex.C + * src/frontends/gnome/FormIndex.h + * src/frontends/gnome/FormToc.C + * src/frontends/gnome/FormToc.h + * src/frontends/gnome/dialogs + * src/frontends/gnome/diatoc_callbacks.c + * src/frontends/gnome/diatoc_callbacks.h + * src/frontends/gnome/diainsertindex_callbacks.h + * src/frontends/gnome/diainsertindex_callbacks.c + * src/frontends/gnome/diainsertindex_interface.c + * src/frontends/gnome/diainsertindex_interface.h + * src/frontends/gnome/diatoc_interface.h + * src/frontends/gnome/diatoc_interface.c + * src/frontends/gnome/Makefile.am: Table of Contents and + Insert Index dialogs implementation for Gnome frontend + + * src/frontends/gnome/GUIRunTime_pimpl.C: fix some small bugs + + * src/frontends/gnome/Menubar_pimpl.C: remove historical comments + + * src/frontends/gnome/diainserturl_interface.c: make the dialog + resizable + 2000-08-17 Lars Gullik Bjønnes * src/frontends/xforms/GUIRunTime_pimpl.C: constructor and diff --git a/po/POTFILES.in b/po/POTFILES.in index 18e7c4644c..bb4622e946 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -27,7 +27,10 @@ src/filedlg.C src/FontLoader.C src/form1.C src/frontends/gnome/FormPrint.C +src/frontends/gnome/FormToc.C src/frontends/kde/FormCopyright.C +src/frontends/kde/FormUrl.C +src/frontends/kde/formurldialog.C src/frontends/xforms/FormCitation.C src/frontends/xforms/form_citation.C src/frontends/xforms/FormCopyright.C diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index 48d23a6a9a..8d68fc7456 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -253,8 +253,15 @@ string CurrentState(BufferView * bv) if (bv->available()) { // I think we should only show changes from the default // font. (Asger) + LyXText *text = 0; + + if (bv->the_locking_inset) + text = bv->the_locking_inset->getLyXText(bv); + if (!text) + text = bv->text; + Buffer * buffer = bv->buffer(); - LyXFont font = bv->text->real_current_font; + LyXFont font = text->real_current_font; LyXFont const & defaultfont = textclasslist .TextClass(buffer->params.textclass) @@ -262,14 +269,14 @@ string CurrentState(BufferView * bv) font.reduce(defaultfont); state = _("Font: ") + font.stateText(&buffer->params); // The paragraph depth - int depth = bv->text->GetDepth(); + int depth = text->GetDepth(); if (depth > 0) state += string(_(", Depth: ")) + tostr(depth); // The paragraph spacing, but only if different from // buffer spacing. - if (!bv->text->cursor.par()->spacing.isDefault()) { + if (!text->cursor.par()->spacing.isDefault()) { Spacing::Space cur_space = - bv->text->cursor.par()->spacing.getSpace(); + text->cursor.par()->spacing.getSpace(); state += _(", Spacing: "); switch (cur_space) { case Spacing::Single: @@ -283,7 +290,7 @@ string CurrentState(BufferView * bv) break; case Spacing::Other: state += _("Other ("); - state += tostr(bv->text->cursor.par()->spacing.getValue()); + state += tostr(text->cursor.par()->spacing.getValue()); state += ")"; break; case Spacing::Default: diff --git a/src/frontends/gnome/FormIndex.C b/src/frontends/gnome/FormIndex.C new file mode 100644 index 0000000000..f99b2a5af2 --- /dev/null +++ b/src/frontends/gnome/FormIndex.C @@ -0,0 +1,158 @@ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== + */ + +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + + +#include "gettext.h" +#include "Dialogs.h" +#include "FormIndex.h" +#include "LyXView.h" +#include "buffer.h" +#include "lyxfunc.h" + +extern "C" { +#include "diainsertindex_interface.h" +#include "support.h" +} + +#include + +#include "gettext.h" +#include "Dialogs.h" +#include "FormIndex.h" +#include "LyXView.h" +#include "buffer.h" +#include "form_index.h" +#include "lyxfunc.h" + +FormIndex::FormIndex(LyXView * lv, Dialogs * d) + : lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL) +{ + // let the dialog be shown + // These are permanent connections so we won't bother + // storing a copy because we won't be disconnecting. + d->showIndex.connect(slot(this, &FormIndex::showInset)); + d->createIndex.connect(slot(this, &FormIndex::createInset)); +} + + +FormIndex::~FormIndex() +{ + hide(); +} + +void FormIndex::showInset( InsetCommand * const inset ) +{ + if( dialog_!=NULL || inset == 0 ) return; + + inset_ = inset; + ih_ = inset_->hide.connect(slot(this, &FormIndex::hide)); + + params = inset->params(); + show(); +} + +void FormIndex::createInset( string const & arg ) +{ + if( dialog_!=NULL ) return; + + params.setFromString( arg ); + show(); +} + +void FormIndex::show() +{ + if (!dialog_) + { + GtkWidget * pd = create_DiaInsertIndex(); + + dialog_ = Gtk::wrap(pd); + keyword_ = Gtk::wrap( GNOME_ENTRY( lookup_widget(pd, "keyword") ) ); + + b_ok = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_ok") ) ); + b_cancel = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_cancel") ) ); + + b_ok->clicked.connect(slot(this, &FormIndex::apply)); + b_ok->clicked.connect(dialog_->destroy.slot()); + b_cancel->clicked.connect(dialog_->destroy.slot()); + dialog_->destroy.connect(slot(this, &FormIndex::free)); + + u_ = d_->updateBufferDependent.connect(slot(this, &FormIndex::update)); + h_ = d_->hideBufferDependent.connect(slot(this, &FormIndex::hide)); + + if (!dialog_->is_visible()) dialog_->show_all(); + + update(); // make sure its up-to-date + } + else + { + Gdk_Window dialog_win(dialog_->get_window()); + dialog_win.raise(); + } +} + +void FormIndex::update() +{ + if (dialog_ != NULL && + lv_->view()->available()) + { + keyword_->get_entry()->set_text(params.getContents().c_str()); + + bool sens = (!(lv_->buffer()->isReadonly())); + + keyword_->set_sensitive(sens); + b_ok->set_sensitive(sens); + } +} + +void FormIndex::hide() +{ + if (dialog_!=NULL) dialog_->destroy(); +} + +void FormIndex::free() +{ + if (dialog_!=NULL) + { + dialog_ = NULL; + u_.disconnect(); + h_.disconnect(); + inset_ = 0; + ih_.disconnect(); + } +} + +void FormIndex::apply() +{ + if( lv_->buffer()->isReadonly() ) return; + + params.setContents( keyword_->get_entry()->get_text() ); + + if( inset_ != 0 ) + { + // Only update if contents have changed + if( params != inset_->params() ) + { + inset_->setParams( params ); + lv_->view()->updateInset( inset_, true ); + } + } + else + { + lv_->getLyXFunc()->Dispatch( LFUN_INDEX_INSERT, + params.getAsString().c_str() ); + } +} diff --git a/src/frontends/gnome/FormIndex.h b/src/frontends/gnome/FormIndex.h new file mode 100644 index 0000000000..e246806b38 --- /dev/null +++ b/src/frontends/gnome/FormIndex.h @@ -0,0 +1,80 @@ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== + */ + +#ifndef FORMINDEX_H +#define FORMINDEX_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "DialogBase.h" +#include "LString.h" +#include "support/utility.hpp" +#include "insets/insetcommand.h" + +#include +#include +#include + +/** This class provides an Gnome implementation of the FormIndex Dialog. + */ +class FormIndex : public DialogBase, public noncopyable { +public: + /// + FormIndex(LyXView *, Dialogs *); + /// + ~FormIndex(); +private: + /// Slot launching dialog to (possibly) create a new inset + void createInset( string const & ); + /// Slot launching dialog to an existing inset + void showInset( InsetCommand * const ); + + /// Update dialog before showing it + virtual void update(); + /// Apply from dialog (modify or create inset) + virtual void apply(); + /// Explicitly free the dialog. + void free(); + /// Create the dialog if necessary, update it and display it. + void show(); + /// Hide the dialog. + void hide(); + + /** Which LyXFunc do we use? + We could modify Dialogs to have a visible LyXFunc* instead and + save a couple of bytes per dialog. + */ + LyXView * lv_; + /** Which Dialogs do we belong to? + Used so we can get at the signals we have to connect to. + */ + Dialogs * d_; + /// pointer to the inset passed through showInset (if any) + InsetCommand * inset_; + /// the nitty-griity. What is modified and passed back + InsetCommandParams params; + /// Update connection. + Connection u_; + /// Hide connection. + Connection h_; + /// inset::hide connection. + Connection ih_; + + /// Real GUI implementation. + Gtk::Widget * dialog_; + Gnome::Entry * keyword_; + Gtk::Button * b_ok; + Gtk::Button * b_cancel; +}; + +#endif diff --git a/src/frontends/gnome/FormToc.C b/src/frontends/gnome/FormToc.C new file mode 100644 index 0000000000..71c3871871 --- /dev/null +++ b/src/frontends/gnome/FormToc.C @@ -0,0 +1,269 @@ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== + */ + +#include +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + + +#include "gettext.h" +#include "Dialogs.h" +#include "FormToc.h" +#include "LyXView.h" +#include "form_toc.h" +#include "lyxtext.h" + +extern "C" { +#include "diatoc_interface.h" +#include "support.h" +} + +#include +#include +#include +#include +#include +#include + +using SigC::bind; + +FormToc::FormToc(LyXView * lv, Dialogs * d) + : lv_(lv), d_(d), u_(0), h_(0), ih_(0), inset_(0), dialog_(NULL), ignore_callback_(false) +{ + // let the dialog be shown + // These are permanent connections so we won't bother + // storing a copy because we won't be disconnecting. + d->showTOC.connect(slot(this, &FormToc::showInset)); + d->createTOC.connect(slot(this, &FormToc::createInset)); +} + + +FormToc::~FormToc() +{ + hide(); +} + +void FormToc::showInset( InsetCommand * const inset ) +{ + if( dialog_!=NULL || inset == 0 ) return; + + inset_ = inset; + ih_ = inset_->hide.connect(slot(this, &FormToc::hide)); + + params = inset->params(); + show(); +} + + +void FormToc::createInset( string const & arg ) +{ + if( dialog_!=NULL ) return; + + params.setFromString( arg ); + show(); +} + + +void FormToc::show() +{ + Gtk::Button * b_refresh; + Gtk::Button * b_close; + Gtk::ScrolledWindow *scrolled_window; + + if (!dialog_) + { + GtkWidget * pd = create_DiaToc(); + + dialog_ = Gtk::wrap( GNOME_DIALOG(pd) ); + choice_ = Gtk::wrap( GTK_OPTION_MENU( lookup_widget(pd, "choice") ) ); + scrolled_window = Gtk::wrap( GTK_SCROLLED_WINDOW( lookup_widget(pd, "scrolledwindow") ) ); + + list_ = manage( new Gtk::List() ); + scrolled_window->add_with_viewport(*list_); + + // fill choice + Gtk::MenuItem * e; + + choice_->get_menu()->items().clear(); + + e = manage( new Gtk::MenuItem(N_("Table of Contents")) ); + e->activate.connect(bind(slot(this, &FormToc::changeList), Buffer::TOC_TOC)); + choice_->get_menu()->append( *e ); + + e = manage( new Gtk::MenuItem(N_("List of Figures")) ); + e->activate.connect(bind(slot(this, &FormToc::changeList), Buffer::TOC_LOF)); + choice_->get_menu()->append( *e ); + + e = manage( new Gtk::MenuItem(N_("List of Tables")) ); + e->activate.connect(bind(slot(this, &FormToc::changeList), Buffer::TOC_LOT)); + choice_->get_menu()->append( *e ); + + e = manage( new Gtk::MenuItem(N_("List of Algorithms")) ); + e->activate.connect(bind(slot(this, &FormToc::changeList), Buffer::TOC_LOA)); + choice_->get_menu()->append( *e ); + + // wrap buttons and connect slots + b_refresh = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_refresh") ) ); + b_close = Gtk::wrap( GTK_BUTTON( lookup_widget(pd, "button_close") ) ); + + b_refresh->clicked.connect(slot(this, &FormToc::update)); + b_close->clicked.connect(dialog_->destroy.slot()); + dialog_->destroy.connect(slot(this, &FormToc::free)); + + u_ = d_->updateBufferDependent.connect(slot(this, &FormToc::update)); + h_ = d_->hideBufferDependent.connect(slot(this, &FormToc::hide)); + + if (!dialog_->is_visible()) dialog_->show_all(); + + update(); // make sure its up-to-date + } + else + { + Gdk_Window dialog_win(dialog_->get_window()); + dialog_win.raise(); + } +} + + +void FormToc::update() +{ + Buffer::TocType type; + string wintitle; + + if (dialog_ != NULL && + !lv_->view()->available()) + { + wintitle = N_( "*** No Document ***"); + dialog_->set_title(wintitle); + list_->items().clear(); + + Gtk::ListItem * l = manage( new Gtk::ListItem(wintitle) ); + list_->items().push_back( *l ); + return; + } + + + if (dialog_ != NULL && + lv_->view()->available()) + { + + int selection = 0; + + if( params.getCmdName() == "tableofcontents" ) + { + type = Buffer::TOC_TOC; + wintitle = N_("Table of Contents"); + selection = 0; + } + else if( params.getCmdName() == "listoffigures" ) + { + type = Buffer::TOC_LOF; + wintitle = N_("List of Figures"); + selection = 1; + } + else if( params.getCmdName() == "listofalgorithms" ) + { + type = Buffer::TOC_LOA; + wintitle = N_("List of Algorithms"); + selection = 3; + } + else + { + type = Buffer::TOC_LOT; + wintitle = N_("List of Tables"); + selection = 2; + } + + ignore_callback_ = true; + choice_->set_history(selection); + ignore_callback_ = false; + + list_->items().clear(); + + dialog_->set_title(wintitle); + + vector toclist = (lv_->view()->buffer()->getTocList())[type]; + + Gtk::ListItem * item; + + vector::const_iterator end = toclist.end(); + for (vector::const_iterator it = toclist.begin(); + it != end; ++it) + { + item = manage( new Gtk::ListItem(string(4*(*it).depth,' ')+(*it).str) ); + item->select.connect(bind(slot(this,&FormToc::apply), (*it))); + list_->add( *item ); + } + } + + dialog_->show_all(); +} + +void FormToc::apply(Buffer::TocItem tg) +{ + if (!lv_->view()->available()) return; + + lv_->view()->beforeChange(); + lv_->view()->text->SetCursor( lv_->view(), tg.par, 0 ); + lv_->view()->text->sel_cursor = lv_->view()->text->cursor; + lv_->view()->update(BufferView::SELECT|BufferView::FITCUR); +} + +void FormToc::changeList(Buffer::TocType type) +{ + if (!ignore_callback_) + { + switch (type) { + case Buffer::TOC_TOC : + { + params.setCmdName("tableofcontents"); + break; + } + case Buffer::TOC_LOF : + { + params.setCmdName("listoffigures"); + break; + } + case Buffer::TOC_LOT : + { + params.setCmdName("listoftabels"); + break; + } + case Buffer::TOC_LOA : + { + params.setCmdName("listofalgorithms"); + break; + } + }; + update(); + } +} + +void FormToc::hide() +{ + if (dialog_!=NULL) dialog_->destroy(); +} + +void FormToc::free() +{ + if (dialog_!=NULL) + { + dialog_ = NULL; + u_.disconnect(); + h_.disconnect(); + inset_ = 0; + ih_.disconnect(); + } +} + diff --git a/src/frontends/gnome/FormToc.h b/src/frontends/gnome/FormToc.h new file mode 100644 index 0000000000..a2356f28fc --- /dev/null +++ b/src/frontends/gnome/FormToc.h @@ -0,0 +1,86 @@ +// -*- C++ -*- +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== + */ + +#ifndef FORMTOC_H +#define FORMTOC_H + +#ifdef __GNUG__ +#pragma interface +#endif + +#include "DialogBase.h" +#include "LString.h" +#include "support/utility.hpp" +#include "insets/insetcommand.h" +#include "buffer.h" + +#include +#include +#include + +/** This class provides an Gnome implementation of the FormToc Dialog. + */ +class FormToc : public DialogBase, public noncopyable { +public: + /// + FormToc(LyXView *, Dialogs *); + /// + ~FormToc(); +private: + /// Slot launching dialog to (possibly) create a new inset + void createInset( string const & ); + /// Slot launching dialog to an existing inset + void showInset( InsetCommand * const ); + + /// Update dialog before showing it + virtual void update(); + /// Explicitly free the dialog. + void free(); + /// Create the dialog if necessary, update it and display it. + void show(); + /// Hide the dialog. + void hide(); + /// move cursor in LyXView + void apply(Buffer::TocItem); + /// change type of the list + void changeList(Buffer::TocType); + + /** Which LyXFunc do we use? + We could modify Dialogs to have a visible LyXFunc* instead and + save a couple of bytes per dialog. + */ + LyXView * lv_; + /** Which Dialogs do we belong to? + Used so we can get at the signals we have to connect to. + */ + Dialogs * d_; + /// pointer to the inset passed through showInset (if any) + InsetCommand * inset_; + /// the nitty-griity. What is modified and passed back + InsetCommandParams params; + /// Update connection. + Connection u_; + /// Hide connection. + Connection h_; + /// inset::hide connection. + Connection ih_; + + /// Real GUI implementation. + Gnome::Dialog * dialog_; + + Gtk::OptionMenu * choice_; + + Gtk::List * list_; + + bool ignore_callback_; +}; + +#endif diff --git a/src/frontends/gnome/GUIRunTime_pimpl.C b/src/frontends/gnome/GUIRunTime_pimpl.C index 418b022df9..47f615855b 100644 --- a/src/frontends/gnome/GUIRunTime_pimpl.C +++ b/src/frontends/gnome/GUIRunTime_pimpl.C @@ -15,12 +15,16 @@ #pragma implementation #endif +#include FORMS_H_LOCATION + #include "GUIRunTime_pimpl.h" +#include "debug.h" + #include using std::endl; -extern bool finised; +extern bool finished; void GUIRunTime::Pimpl::processEvents() { diff --git a/src/frontends/gnome/Makefile.am b/src/frontends/gnome/Makefile.am index 13a9b59acf..280099b148 100644 --- a/src/frontends/gnome/Makefile.am +++ b/src/frontends/gnome/Makefile.am @@ -40,6 +40,10 @@ libgnome_la_SOURCES = \ FormPrint.h \ FormUrl.C \ FormUrl.h \ + FormIndex.C \ + FormIndex.h \ + FormToc.C \ + FormToc.h \ Menubar_pimpl.C \ Menubar_pimpl.h \ mainapp.C \ @@ -53,7 +57,15 @@ libgnome_la_SOURCES = \ diainserturl_callbacks.c \ diainserturl_interface.c \ diainserturl_callbacks.h \ - diainserturl_interface.h + diainserturl_interface.h \ + diainsertindex_callbacks.c \ + diainsertindex_interface.c \ + diainsertindex_callbacks.h \ + diainsertindex_interface.h \ + diatoc_callbacks.c \ + diatoc_interface.c \ + diatoc_callbacks.h \ + diatoc_interface.h # These still have to be added. Sooner or later. ARRae-20000411 # GUI_defaults.C \ diff --git a/src/frontends/gnome/Menubar_pimpl.C b/src/frontends/gnome/Menubar_pimpl.C index f6c47126ba..9135ad435c 100644 --- a/src/frontends/gnome/Menubar_pimpl.C +++ b/src/frontends/gnome/Menubar_pimpl.C @@ -85,8 +85,11 @@ void Menubar::Pimpl::set(string const & menu_name) void Menubar::Pimpl::callback(int action) { // Dispatch action OR record action to local variable (see connectWidgetToAction) - if (!ignore_action_) owner_->getLyXFunc()->Dispatch(action); - else action_ = action; + if (!ignore_action_) { + Pimpl::update(); + owner_->getLyXFunc()->Dispatch(action); + } else + action_ = action; } void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector & Menus) @@ -148,7 +151,12 @@ void Menubar::Pimpl::composeUIInfo(string const & menu_name, vector +#endif + +#include + +#include "diainsertindex_callbacks.h" +#include "diainsertindex_interface.h" +#include "support.h" + diff --git a/src/frontends/gnome/diainsertindex_callbacks.h b/src/frontends/gnome/diainsertindex_callbacks.h new file mode 100644 index 0000000000..096523c330 --- /dev/null +++ b/src/frontends/gnome/diainsertindex_callbacks.h @@ -0,0 +1,11 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== */ + +#include + diff --git a/src/frontends/gnome/diainsertindex_interface.c b/src/frontends/gnome/diainsertindex_interface.c new file mode 100644 index 0000000000..b553a3b235 --- /dev/null +++ b/src/frontends/gnome/diainsertindex_interface.c @@ -0,0 +1,100 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include + +#include "diainsertindex_callbacks.h" +#include "diainsertindex_interface.h" +#include "support.h" + +GtkWidget* +create_DiaInsertIndex (void) +{ + GtkWidget *DiaInsertIndex; + GtkWidget *dialog_vbox1; + GtkWidget *hbox1; + GtkWidget *label; + GtkWidget *keyword; + GtkWidget *combo_entry1; + GtkWidget *dialog_action_area1; + GtkWidget *button_ok; + GtkWidget *button_cancel; + + DiaInsertIndex = gnome_dialog_new (_("Insert Index"), NULL); + gtk_object_set_data (GTK_OBJECT (DiaInsertIndex), "DiaInsertIndex", DiaInsertIndex); + gtk_container_set_border_width (GTK_CONTAINER (DiaInsertIndex), 2); + GTK_WINDOW (DiaInsertIndex)->type = GTK_WINDOW_DIALOG; + gtk_window_set_policy (GTK_WINDOW (DiaInsertIndex), TRUE, TRUE, FALSE); + + dialog_vbox1 = GNOME_DIALOG (DiaInsertIndex)->vbox; + gtk_object_set_data (GTK_OBJECT (DiaInsertIndex), "dialog_vbox1", dialog_vbox1); + gtk_widget_show (dialog_vbox1); + + hbox1 = gtk_hbox_new (FALSE, 2); + gtk_widget_ref (hbox1); + gtk_object_set_data_full (GTK_OBJECT (DiaInsertIndex), "hbox1", hbox1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (hbox1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (hbox1), 2); + + label = gtk_label_new (_("Keyword")); + gtk_widget_ref (label); + gtk_object_set_data_full (GTK_OBJECT (DiaInsertIndex), "label", label, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (label); + gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); + + keyword = gnome_entry_new ("diainsertindex_keyword"); + gtk_widget_ref (keyword); + gtk_object_set_data_full (GTK_OBJECT (DiaInsertIndex), "keyword", keyword, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (keyword); + gtk_box_pack_start (GTK_BOX (hbox1), keyword, TRUE, TRUE, 0); + gtk_container_set_border_width (GTK_CONTAINER (keyword), 2); + + combo_entry1 = gnome_entry_gtk_entry (GNOME_ENTRY (keyword)); + gtk_widget_ref (combo_entry1); + gtk_object_set_data_full (GTK_OBJECT (DiaInsertIndex), "combo_entry1", combo_entry1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (combo_entry1); + GTK_WIDGET_SET_FLAGS (combo_entry1, GTK_CAN_DEFAULT); + + dialog_action_area1 = GNOME_DIALOG (DiaInsertIndex)->action_area; + gtk_object_set_data (GTK_OBJECT (DiaInsertIndex), "dialog_action_area1", dialog_action_area1); + gtk_widget_show (dialog_action_area1); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); + gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area1), 8); + + gnome_dialog_append_button (GNOME_DIALOG (DiaInsertIndex), GNOME_STOCK_BUTTON_OK); + button_ok = g_list_last (GNOME_DIALOG (DiaInsertIndex)->buttons)->data; + gtk_widget_ref (button_ok); + gtk_object_set_data_full (GTK_OBJECT (DiaInsertIndex), "button_ok", button_ok, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (button_ok); + GTK_WIDGET_SET_FLAGS (button_ok, GTK_CAN_DEFAULT); + + gnome_dialog_append_button (GNOME_DIALOG (DiaInsertIndex), GNOME_STOCK_BUTTON_CANCEL); + button_cancel = g_list_last (GNOME_DIALOG (DiaInsertIndex)->buttons)->data; + gtk_widget_ref (button_cancel); + gtk_object_set_data_full (GTK_OBJECT (DiaInsertIndex), "button_cancel", button_cancel, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (button_cancel); + GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT); + + gtk_widget_grab_focus (combo_entry1); + gtk_widget_grab_default (combo_entry1); + return DiaInsertIndex; +} + diff --git a/src/frontends/gnome/diainsertindex_interface.h b/src/frontends/gnome/diainsertindex_interface.h new file mode 100644 index 0000000000..5f9852e9bb --- /dev/null +++ b/src/frontends/gnome/diainsertindex_interface.h @@ -0,0 +1,5 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +GtkWidget* create_DiaInsertIndex (void); diff --git a/src/frontends/gnome/diainserturl_interface.c b/src/frontends/gnome/diainserturl_interface.c index 1d51a8368f..4844eb0012 100644 --- a/src/frontends/gnome/diainserturl_interface.c +++ b/src/frontends/gnome/diainserturl_interface.c @@ -43,7 +43,7 @@ create_DiaInsertUrl (void) gtk_object_set_data (GTK_OBJECT (DiaInsertUrl), "DiaInsertUrl", DiaInsertUrl); gtk_container_set_border_width (GTK_CONTAINER (DiaInsertUrl), 2); GTK_WINDOW (DiaInsertUrl)->type = GTK_WINDOW_DIALOG; - gtk_window_set_policy (GTK_WINDOW (DiaInsertUrl), FALSE, FALSE, FALSE); + gtk_window_set_policy (GTK_WINDOW (DiaInsertUrl), TRUE, TRUE, FALSE); dialog_vbox1 = GNOME_DIALOG (DiaInsertUrl)->vbox; gtk_object_set_data (GTK_OBJECT (DiaInsertUrl), "dialog_vbox1", dialog_vbox1); @@ -100,6 +100,7 @@ create_DiaInsertUrl (void) gtk_object_set_data_full (GTK_OBJECT (DiaInsertUrl), "combo_entry1", combo_entry1, (GtkDestroyNotify) gtk_widget_unref); gtk_widget_show (combo_entry1); + GTK_WIDGET_SET_FLAGS (combo_entry1, GTK_CAN_DEFAULT); name = gnome_entry_new ("diainserturl_name"); gtk_widget_ref (name); @@ -151,7 +152,8 @@ create_DiaInsertUrl (void) gtk_widget_show (button_cancel); GTK_WIDGET_SET_FLAGS (button_cancel, GTK_CAN_DEFAULT); - gtk_widget_grab_default (button_ok); + gtk_widget_grab_focus (combo_entry1); + gtk_widget_grab_default (combo_entry1); gtk_window_add_accel_group (GTK_WINDOW (DiaInsertUrl), accel_group); return DiaInsertUrl; diff --git a/src/frontends/gnome/dialogs/diainsertindex.glade b/src/frontends/gnome/dialogs/diainsertindex.glade new file mode 100644 index 0000000000..7bd4732c58 --- /dev/null +++ b/src/frontends/gnome/dialogs/diainsertindex.glade @@ -0,0 +1,141 @@ + + + + + insertindex + insertindex + + src + pixmaps + C + True + True + False + False + False + diainsertindex_interface.c + diainsertindex_interface.h + diainsertindex_callbacks.c + diainsertindex_callbacks.h + + + + GnomeDialog + DiaInsertIndex + 2 + Insert Index + GTK_WINDOW_DIALOG + GTK_WIN_POS_NONE + False + True + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox1 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button_ok + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button_cancel + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + GtkHBox + hbox1 + 2 + False + 2 + + 0 + True + True + + + + GtkLabel + label + + GTK_JUSTIFY_LEFT + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GnomeEntry + keyword + 2 + diainsertindex_keyword + 10 + + 0 + True + True + + + + GtkEntry + GnomeEntry:entry + combo-entry1 + True + True + True + True + True + True + 0 + + + + + + + + diff --git a/src/frontends/gnome/dialogs/diainserturl.glade b/src/frontends/gnome/dialogs/diainserturl.glade index 89df1b48da..5c12b415df 100644 --- a/src/frontends/gnome/dialogs/diainserturl.glade +++ b/src/frontends/gnome/dialogs/diainserturl.glade @@ -27,8 +27,8 @@ GTK_WINDOW_DIALOG GTK_WIN_POS_NONE False - False - False + True + True False False False @@ -66,7 +66,6 @@ GtkButton button_ok True - True True GNOME_STOCK_BUTTON_OK @@ -182,7 +181,10 @@ GtkEntry GnomeEntry:entry combo-entry1 + True + True True + True True True 0 diff --git a/src/frontends/gnome/dialogs/diatoc.glade b/src/frontends/gnome/dialogs/diatoc.glade new file mode 100644 index 0000000000..3e3143229b --- /dev/null +++ b/src/frontends/gnome/dialogs/diatoc.glade @@ -0,0 +1,138 @@ + + + + + diatoc + diatoc + + src + pixmaps + C + True + True + False + False + False + diatoc_interface.c + diatoc_interface.h + diatoc_callbacks.c + diatoc_callbacks.h + + + + GnomeDialog + DiaToc + 2 + Table of Contents + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox2 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button_refresh + True + True + + GNOME_STOCK_PIXMAP_REFRESH + + + + GtkButton + button_close + True + True + GNOME_STOCK_BUTTON_CLOSE + + + + + GtkVBox + vbox1 + False + 0 + + 0 + True + True + + + + GtkScrolledWindow + scrolledwindow + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkViewport + viewport1 + 522 + 289 + GTK_SHADOW_IN + + + Placeholder + + + + + + GtkOptionMenu + choice + 2 + True + DUMMY + + 0 + + 0 + False + False + + + + + + + diff --git a/src/frontends/gnome/diatoc_callbacks.c b/src/frontends/gnome/diatoc_callbacks.c new file mode 100644 index 0000000000..b615ca9a33 --- /dev/null +++ b/src/frontends/gnome/diatoc_callbacks.c @@ -0,0 +1,19 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "diatoc_callbacks.h" +#include "diatoc_interface.h" +#include "support.h" + diff --git a/src/frontends/gnome/diatoc_callbacks.h b/src/frontends/gnome/diatoc_callbacks.h new file mode 100644 index 0000000000..096523c330 --- /dev/null +++ b/src/frontends/gnome/diatoc_callbacks.h @@ -0,0 +1,11 @@ +/* This file is part of + * ====================================================== + * + * LyX, The Document Processor + * + * Copyright 2000 The LyX Team. + * + * ====================================================== */ + +#include + diff --git a/src/frontends/gnome/diatoc_interface.c b/src/frontends/gnome/diatoc_interface.c new file mode 100644 index 0000000000..ea9fb6dca8 --- /dev/null +++ b/src/frontends/gnome/diatoc_interface.c @@ -0,0 +1,105 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include + +#include "diatoc_callbacks.h" +#include "diatoc_interface.h" +#include "support.h" + +GtkWidget* +create_DiaToc (void) +{ + GtkWidget *DiaToc; + GtkWidget *dialog_vbox2; + GtkWidget *vbox1; + GtkWidget *scrolledwindow; + GtkWidget *viewport1; + GtkWidget *choice; + GtkWidget *choice_menu; + GtkWidget *glade_menuitem; + GtkWidget *dialog_action_area1; + GtkWidget *button_refresh; + GtkWidget *button_close; + + DiaToc = gnome_dialog_new (_("Table of Contents"), NULL); + gtk_object_set_data (GTK_OBJECT (DiaToc), "DiaToc", DiaToc); + gtk_container_set_border_width (GTK_CONTAINER (DiaToc), 2); + gtk_window_set_policy (GTK_WINDOW (DiaToc), TRUE, TRUE, FALSE); + + dialog_vbox2 = GNOME_DIALOG (DiaToc)->vbox; + gtk_object_set_data (GTK_OBJECT (DiaToc), "dialog_vbox2", dialog_vbox2); + gtk_widget_show (dialog_vbox2); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_ref (vbox1); + gtk_object_set_data_full (GTK_OBJECT (DiaToc), "vbox1", vbox1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (vbox1); + gtk_box_pack_start (GTK_BOX (dialog_vbox2), vbox1, TRUE, TRUE, 0); + + scrolledwindow = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_ref (scrolledwindow); + gtk_object_set_data_full (GTK_OBJECT (DiaToc), "scrolledwindow", scrolledwindow, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (scrolledwindow); + gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow, TRUE, TRUE, 0); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + + viewport1 = gtk_viewport_new (NULL, NULL); + gtk_widget_ref (viewport1); + gtk_object_set_data_full (GTK_OBJECT (DiaToc), "viewport1", viewport1, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (viewport1); + gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport1); + gtk_widget_set_usize (viewport1, 522, 289); + + choice = gtk_option_menu_new (); + gtk_widget_ref (choice); + gtk_object_set_data_full (GTK_OBJECT (DiaToc), "choice", choice, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (choice); + gtk_box_pack_start (GTK_BOX (vbox1), choice, FALSE, FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (choice), 2); + choice_menu = gtk_menu_new (); + glade_menuitem = gtk_menu_item_new_with_label (_("DUMMY")); + gtk_widget_show (glade_menuitem); + gtk_menu_append (GTK_MENU (choice_menu), glade_menuitem); + gtk_option_menu_set_menu (GTK_OPTION_MENU (choice), choice_menu); + + dialog_action_area1 = GNOME_DIALOG (DiaToc)->action_area; + gtk_object_set_data (GTK_OBJECT (DiaToc), "dialog_action_area1", dialog_action_area1); + gtk_widget_show (dialog_action_area1); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); + gtk_button_box_set_spacing (GTK_BUTTON_BOX (dialog_action_area1), 8); + + gnome_dialog_append_button_with_pixmap (GNOME_DIALOG (DiaToc), + _("Refresh"), GNOME_STOCK_PIXMAP_REFRESH); + button_refresh = g_list_last (GNOME_DIALOG (DiaToc)->buttons)->data; + gtk_widget_ref (button_refresh); + gtk_object_set_data_full (GTK_OBJECT (DiaToc), "button_refresh", button_refresh, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (button_refresh); + GTK_WIDGET_SET_FLAGS (button_refresh, GTK_CAN_DEFAULT); + + gnome_dialog_append_button (GNOME_DIALOG (DiaToc), GNOME_STOCK_BUTTON_CLOSE); + button_close = g_list_last (GNOME_DIALOG (DiaToc)->buttons)->data; + gtk_widget_ref (button_close); + gtk_object_set_data_full (GTK_OBJECT (DiaToc), "button_close", button_close, + (GtkDestroyNotify) gtk_widget_unref); + gtk_widget_show (button_close); + GTK_WIDGET_SET_FLAGS (button_close, GTK_CAN_DEFAULT); + + return DiaToc; +} + diff --git a/src/frontends/gnome/diatoc_interface.h b/src/frontends/gnome/diatoc_interface.h new file mode 100644 index 0000000000..748a260e5d --- /dev/null +++ b/src/frontends/gnome/diatoc_interface.h @@ -0,0 +1,5 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +GtkWidget* create_DiaToc (void); diff --git a/src/frontends/kde/GUIRunTime_pimpl.C b/src/frontends/kde/GUIRunTime_pimpl.C index 26b251337b..bb0afcc921 100644 --- a/src/frontends/kde/GUIRunTime_pimpl.C +++ b/src/frontends/kde/GUIRunTime_pimpl.C @@ -16,8 +16,12 @@ #endif #include "GUIRunTime_pimpl.h" +#include "debug.h" + #include +#include FORMS_H_LOCATION + using std::endl; extern bool finished; diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 0b0ea05d5d..ab3b6b8dd4 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -423,6 +423,7 @@ void InsetText::UpdateLocal(BufferView * bv, UpdateCodes what, bool mark_dirty) if ((need_update != CURSOR) || (TEXT(bv)->status != LyXText::UNCHANGED) || TEXT(bv)->selection) bv->updateInset(this, mark_dirty); + bv->owner()->showState(); if (old_par != cpar(bv)) { bv->owner()->setLayout(cpar(bv)->GetLayout()); old_par = cpar(bv); diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 03c725ebd8..c359d127f8 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -620,7 +620,13 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const if (buf) { func_status box = LyXFunc::ToggleOff; - LyXFont font = owner->view()->text->real_current_font; + LyXFont font; + if (owner->view()->the_locking_inset && + owner->view()->the_locking_inset->getLyXText(owner->view())) + font = owner->view()->the_locking_inset-> + getLyXText(owner->view())->real_current_font; + else + font = owner->view()->text->real_current_font; switch (action) { case LFUN_EMPH: if (font.emph() == LyXFont::ON)