fix call to Dispatch

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1028 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-09-19 11:18:35 +00:00
parent 4585597f47
commit 0031da054f
19 changed files with 87 additions and 69 deletions

View File

@ -1,5 +1,27 @@
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

View File

@ -52,5 +52,5 @@ bindist:
sourcedoc:
mkdir sourcedoc
cd sourcedoc
doc++ -p $(srcdir)/src/*.h
cd sourcedoc ; \
doc++ -p `find ../$(top_srcdir)/src -name \*.h`

View File

@ -3801,7 +3801,7 @@ bool Buffer::Dispatch(string const & command)
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);
}

View File

@ -63,6 +63,8 @@ int GUIRunTime::initApplication(int, char * argv[])
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);

View File

@ -63,6 +63,8 @@ int GUIRunTime::initApplication(int argc, char * 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;

View File

@ -449,8 +449,7 @@ void FormCitation::apply()
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);
@ -458,6 +457,6 @@ void FormCitation::apply()
}
} else {
lv_->getLyXFunc()->Dispatch(LFUN_CITATION_INSERT,
params.getAsString().c_str() );
params.getAsString());
}
}

View File

@ -87,8 +87,7 @@ void FormIndex::apply()
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);
@ -96,6 +95,6 @@ void FormIndex::apply()
}
} else {
lv_->getLyXFunc()->Dispatch(LFUN_INDEX_INSERT,
params.getAsString().c_str() );
params.getAsString());
}
}

View File

@ -234,13 +234,12 @@ void FormRef::apply()
if (!lv_->view()->available())
return;
Type type = static_cast<Type>( fl_get_choice(dialog_->type)-1 );
Type const type = static_cast<Type>(fl_get_choice(dialog_->type) - 1);
params.setCmdName(getName(type));
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);
@ -248,7 +247,7 @@ void FormRef::apply()
}
} else {
lv_->getLyXFunc()->Dispatch(LFUN_REF_INSERT,
params.getAsString().c_str() );
params.getAsString());
}
}
@ -267,7 +266,7 @@ void FormRef::input( long data )
{
lv_->getLyXFunc()->
Dispatch(LFUN_REF_GOTO,
params.getContents().c_str());
params.getContents());
fl_set_object_label(dialog_->go, _("Go back"));
}
break;

View File

@ -146,9 +146,9 @@ void FormToc::apply()
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);
}
}

View File

@ -103,8 +103,7 @@ void FormUrl::apply()
else
params.setCmdName("url");
if( inset_ != 0 )
{
if(inset_ != 0) {
// Only update if contents have changed
if(params != inset_->params()) {
inset_->setParams(params);
@ -112,6 +111,6 @@ void FormUrl::apply()
}
} else {
lv_->getLyXFunc()->Dispatch(LFUN_INSERT_URL,
params.getAsString().c_str() );
params.getAsString());
}
}

View File

@ -173,7 +173,7 @@ void include_cb(FL_OBJECT *, long arg)
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;

View File

@ -49,7 +49,7 @@ string const InsetParent::getScreenLabel() const
void InsetParent::Edit(BufferView * bv, int, int, unsigned int)
{
bv->owner()->getLyXFunc()->
Dispatch(LFUN_CHILDOPEN, getContents().c_str());
Dispatch(LFUN_CHILDOPEN, getContents());
}

View File

@ -28,7 +28,7 @@ void InsetRef::Edit(BufferView * bv, int, int, unsigned int button)
// 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 );
}

View File

@ -1178,7 +1178,7 @@ void LayoutsCB(int sel, void *, Combox *)
{
string tmp = tostr(sel);
current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
tmp.c_str());
tmp);
}
#ifndef NEW_EXPORT

View File

@ -298,7 +298,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
bool tmp_sc = show_sc;
show_sc = false;
Dispatch(action, argument.c_str());
Dispatch(action, argument);
show_sc = tmp_sc;
return 0;
@ -432,7 +432,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
bool tmp_sc = show_sc;
show_sc = false;
Dispatch(action, argument.c_str());
Dispatch(action, argument);
show_sc = tmp_sc;
return 0;
@ -650,10 +650,11 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
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);
}
@ -1388,7 +1389,7 @@ string const LyXFunc::Dispatch(int ac,
Dispatch(int(LFUN_LAYOUT),
textclasslist.NameOfLayout(owner->view()
->buffer()->params.textclass,
sel).c_str());
sel));
return string();
}

View File

@ -528,7 +528,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
string rval, buf;
if (action>= 0) {
rval = serv->func->Dispatch(action, arg.c_str());
rval = serv->func->Dispatch(action, arg);
} else {
rval = "Unknown command";
}

View File

@ -9,7 +9,6 @@
* ====================================================== */
#include <config.h>
#include <iostream>
#include "lyx_main.h"
#include "gettext.h"
@ -17,14 +16,10 @@
#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;
@ -35,8 +30,8 @@ int main(int argc, char * argv[])
lyx_localedir = LOCALEDIR;
// initialize for internationalized version *EK*
locale_init();
gettext_init();
locale_init(); // macro
gettext_init(); // macro
#ifdef __EMX__
_wildcard(&argc, &argv);