+2000-09-19 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * src/buffer.C (Dispatch): fix call to Dispatch
+ * src/insets/insetref.C (Edit): likewise
+ * src/insets/insetparent.C (Edit): likewise
+ * src/insets/insetinclude.C (include_cb): likewise
+ * src/frontends/xforms/FormUrl.C (apply): likewise
+ * src/frontends/xforms/FormToc.C (apply): likewise
+ * src/frontends/xforms/FormRef.C (apply): likewise
+ * src/frontends/xforms/FormIndex.C (apply): likewise
+ * src/frontends/xforms/FormCitation.C (apply): likewise
+ * src/lyxserver.C (callback): likewise
+ * src/lyxfunc.C (processKeySym): likewise
+ (Dispatch): likewise
+ (Dispatch): likewise
+ * src/lyx_cb.C (LayoutsCB): likewise
+
+ * Makefile.am (sourcedoc): small change
+
2000-09-18 Lars Gullik Bjønnes <larsbj@lyx.org>
+ * src/main.C (main): Don't make an empty GUIRunTime object. all
+ methods are static. constify a bit remove unneded using + headers.
+
* src/tabular.C: some more const to local vars move some loop vars
* src/spellchecker.C: added some c_str after some word for pspell
sourcedoc:
mkdir sourcedoc
- cd sourcedoc
- doc++ -p $(srcdir)/src/*.h
+ cd sourcedoc ; \
+ doc++ -p `find ../$(top_srcdir)/src -name \*.h`
string cmd, line = frontStrip(command);
string arg = strip(frontStrip(split(line, cmd, ' ')));
- return Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg.c_str());
+ return Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg);
}
return 1;
}
+ // I belive that this should be done at a later stage, in
+ // lyx_gui, the same place as xforms does the same. (Lgb)
static string app_id(PACKAGE);
static string app_version(VERSION);
static Gnome::Main a(app_id, app_version, 1, argv);
return 1;
}
+ // I belive this is done in the wrong place, imo this should
+ // be done in lyx_gui.C similar to how/where xforms does it (Lgb)
static KApplication a(argc, argv);
return 0;
void FormCitation::apply()
{
- if( lv_->buffer()->isReadonly() ) return;
+ if(lv_->buffer()->isReadonly()) return;
string contents;
- for( unsigned int i = 0; i < citekeys.size(); ++i ) {
+ for(unsigned int i = 0; i < citekeys.size(); ++i) {
if (i > 0) contents += ", ";
contents += citekeys[i];
}
- params.setContents( contents );
- params.setOptions( fl_get_input(dialog_->textAftr) );
+ params.setContents(contents);
+ params.setOptions(fl_get_input(dialog_->textAftr));
- if( inset_ != 0 )
- {
+ if (inset_ != 0) {
// Only update if contents have changed
- if( params != inset_->params() ) {
- inset_->setParams( params );
- lv_->view()->updateInset( inset_, true );
+ if(params != inset_->params()) {
+ inset_->setParams(params);
+ lv_->view()->updateInset(inset_, true);
}
} else {
- lv_->getLyXFunc()->Dispatch( LFUN_CITATION_INSERT,
- params.getAsString().c_str() );
+ lv_->getLyXFunc()->Dispatch(LFUN_CITATION_INSERT,
+ params.getAsString());
}
}
void FormIndex::apply()
{
- if( lv_->buffer()->isReadonly() ) return;
+ if(lv_->buffer()->isReadonly()) return;
- params.setContents( fl_get_input(dialog_->key) );
+ params.setContents(fl_get_input(dialog_->key));
- if( inset_ != 0 )
- {
+ if (inset_ != 0) {
// Only update if contents have changed
- if( params != inset_->params() ) {
- inset_->setParams( params );
- lv_->view()->updateInset( inset_, true );
+ if (params != inset_->params()) {
+ inset_->setParams(params);
+ lv_->view()->updateInset(inset_, true);
}
} else {
- lv_->getLyXFunc()->Dispatch( LFUN_INDEX_INSERT,
- params.getAsString().c_str() );
+ lv_->getLyXFunc()->Dispatch(LFUN_INDEX_INSERT,
+ params.getAsString());
}
}
if (!lv_->view()->available())
return;
- Type type = static_cast<Type>( fl_get_choice(dialog_->type)-1 );
- params.setCmdName( getName( type ) );
+ Type const type = static_cast<Type>(fl_get_choice(dialog_->type) - 1);
+ params.setCmdName(getName(type));
- params.setOptions( fl_get_input(dialog_->name) );
+ params.setOptions(fl_get_input(dialog_->name));
- if( inset_ != 0 )
- {
+ if (inset_ != 0) {
// Only update if contents have changed
- if( params != inset_->params() ) {
- inset_->setParams( params );
- lv_->view()->updateInset( inset_, true );
+ if(params != inset_->params()) {
+ inset_->setParams(params);
+ lv_->view()->updateInset(inset_, true);
}
} else {
- lv_->getLyXFunc()->Dispatch( LFUN_REF_INSERT,
- params.getAsString().c_str() );
+ lv_->getLyXFunc()->Dispatch(LFUN_REF_INSERT,
+ params.getAsString());
}
}
toggle = static_cast<Goto>(toggle + 1);
if( toggle == GOFIRST ) toggle = GOREF;
- switch( toggle ) {
+ switch (toggle) {
case GOREF:
{
lv_->getLyXFunc()->
Dispatch(LFUN_REF_GOTO,
- params.getContents().c_str());
+ params.getContents());
fl_set_object_label(dialog_->go, _("Go back"));
}
break;
updateToc();
- unsigned int choice = fl_get_browser( dialog_->browser );
+ unsigned int const choice = fl_get_browser( dialog_->browser );
if (0 < choice && choice - 1 < toclist.size()) {
- string tmp = tostr(toclist[choice-1].par->id());
- lv_->getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tmp.c_str());
+ string const tmp = tostr(toclist[choice-1].par->id());
+ lv_->getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tmp);
}
}
void FormUrl::apply()
{
- if( lv_->buffer()->isReadonly() ) return;
+ if(lv_->buffer()->isReadonly()) return;
- params.setContents( fl_get_input(dialog_->url) );
- params.setOptions( fl_get_input(dialog_->name) );
+ params.setContents(fl_get_input(dialog_->url));
+ params.setOptions(fl_get_input(dialog_->name));
if (fl_get_button(dialog_->radio_html))
params.setCmdName("htmlurl");
else
params.setCmdName("url");
- if( inset_ != 0 )
- {
+ if(inset_ != 0) {
// Only update if contents have changed
- if( params != inset_->params() ) {
- inset_->setParams( params );
- lv_->view()->updateInset( inset_, true );
+ if(params != inset_->params()) {
+ inset_->setParams(params);
+ lv_->view()->updateInset(inset_, true);
}
} else {
- lv_->getLyXFunc()->Dispatch( LFUN_INSERT_URL,
- params.getAsString().c_str() );
+ lv_->getLyXFunc()->Dispatch(LFUN_INSERT_URL,
+ params.getAsString());
}
}
fl_hide_form(form->include);
current_view->updateInset(inset, true);
- current_view->owner()->getLyXFunc()->Dispatch(LFUN_CHILDOPEN, inset->getContents().c_str());
+ current_view->owner()->getLyXFunc()->Dispatch(LFUN_CHILDOPEN, inset->getContents());
}
break;
void InsetParent::Edit(BufferView * bv, int, int, unsigned int)
{
bv->owner()->getLyXFunc()->
- Dispatch(LFUN_CHILDOPEN, getContents().c_str());
+ Dispatch(LFUN_CHILDOPEN, getContents());
}
// Eventually trigger dialog with button 3 not 1
if( button == 3 )
bv->owner()->getLyXFunc()->
- Dispatch(LFUN_REF_GOTO, getContents().c_str());
+ Dispatch(LFUN_REF_GOTO, getContents());
else if( button == 1 )
bv->owner()->getDialogs()->showRef( this );
}
{
string tmp = tostr(sel);
current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
- tmp.c_str());
+ tmp);
}
#ifndef NEW_EXPORT
bool tmp_sc = show_sc;
show_sc = false;
- Dispatch(action, argument.c_str());
+ Dispatch(action, argument);
show_sc = tmp_sc;
return 0;
bool tmp_sc = show_sc;
show_sc = false;
- Dispatch(action, argument.c_str());
+ Dispatch(action, argument);
show_sc = tmp_sc;
return 0;
string const LyXFunc::Dispatch(string const & s)
{
// Split command string into command and argument
- string cmd, line = frontStrip(s);
+ string cmd;
+ string line = frontStrip(s);
string arg = strip(frontStrip(split(line, cmd, ' ')));
- return Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg.c_str());
+ return Dispatch(lyxaction.LookupFunc(cmd.c_str()), arg);
}
Dispatch(int(LFUN_LAYOUT),
textclasslist.NameOfLayout(owner->view()
->buffer()->params.textclass,
- sel).c_str());
+ sel));
return string();
}
string rval, buf;
if (action>= 0) {
- rval = serv->func->Dispatch(action, arg.c_str());
+ rval = serv->func->Dispatch(action, arg);
} else {
rval = "Unknown command";
}
* ====================================================== */
#include <config.h>
-#include <iostream>
#include "lyx_main.h"
#include "gettext.h"
#include "support/filetools.h"
#include "frontends/GUIRunTime.h"
-using std::cerr;
-using std::endl;
-
-GUIRunTime guiruntime;
int main(int argc, char * argv[])
{
- int val = guiruntime.initApplication(argc, argv);
+ int const val = GUIRunTime::initApplication(argc, argv);
if (val)
return val;
lyx_localedir = LOCALEDIR;
// initialize for internationalized version *EK*
- locale_init();
- gettext_init();
+ locale_init(); // macro
+ gettext_init(); // macro
#ifdef __EMX__
_wildcard(&argc, &argv);
/* callbacks for form delim */
void delim_cb(FL_OBJECT *, long data)
{
- int left= fd_delim->left->u_ldata, right= fd_delim->right->u_ldata;
- int side= (fl_get_button(fd_delim->right)!= 0);
+ int left = fd_delim->left->u_ldata, right= fd_delim->right->u_ldata;
+ int side = (fl_get_button(fd_delim->right)!= 0);
switch (data) {
case MM_APPLY:
///
mutable int history_cnt;
///
- void addHistory(string const &cmd) const {
+ void addHistory(string const & cmd) const {
if (history_cnt == 0
|| (history_cnt > 0
&& cmd != history[(history_cnt - 1) % MAX_HISTORY])) {