mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
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:
parent
4585597f47
commit
0031da054f
22
ChangeLog
22
ChangeLog
@ -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>
|
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/tabular.C: some more const to local vars move some loop vars
|
||||||
|
|
||||||
* src/spellchecker.C: added some c_str after some word for pspell
|
* src/spellchecker.C: added some c_str after some word for pspell
|
||||||
|
@ -52,5 +52,5 @@ bindist:
|
|||||||
|
|
||||||
sourcedoc:
|
sourcedoc:
|
||||||
mkdir sourcedoc
|
mkdir sourcedoc
|
||||||
cd sourcedoc
|
cd sourcedoc ; \
|
||||||
doc++ -p $(srcdir)/src/*.h
|
doc++ -p `find ../$(top_srcdir)/src -name \*.h`
|
||||||
|
@ -3801,7 +3801,7 @@ bool Buffer::Dispatch(string const & command)
|
|||||||
string cmd, line = frontStrip(command);
|
string cmd, line = frontStrip(command);
|
||||||
string arg = strip(frontStrip(split(line, cmd, ' ')));
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,6 +63,8 @@ int GUIRunTime::initApplication(int, char * argv[])
|
|||||||
return 1;
|
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_id(PACKAGE);
|
||||||
static string app_version(VERSION);
|
static string app_version(VERSION);
|
||||||
static Gnome::Main a(app_id, app_version, 1, argv);
|
static Gnome::Main a(app_id, app_version, 1, argv);
|
||||||
|
@ -63,6 +63,8 @@ int GUIRunTime::initApplication(int argc, char * argv[])
|
|||||||
return 1;
|
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);
|
static KApplication a(argc, argv);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -438,26 +438,25 @@ void FormCitation::input( long data )
|
|||||||
|
|
||||||
void FormCitation::apply()
|
void FormCitation::apply()
|
||||||
{
|
{
|
||||||
if( lv_->buffer()->isReadonly() ) return;
|
if(lv_->buffer()->isReadonly()) return;
|
||||||
|
|
||||||
string contents;
|
string contents;
|
||||||
for( unsigned int i = 0; i < citekeys.size(); ++i ) {
|
for(unsigned int i = 0; i < citekeys.size(); ++i) {
|
||||||
if (i > 0) contents += ", ";
|
if (i > 0) contents += ", ";
|
||||||
contents += citekeys[i];
|
contents += citekeys[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
params.setContents( contents );
|
params.setContents(contents);
|
||||||
params.setOptions( fl_get_input(dialog_->textAftr) );
|
params.setOptions(fl_get_input(dialog_->textAftr));
|
||||||
|
|
||||||
if( inset_ != 0 )
|
if (inset_ != 0) {
|
||||||
{
|
|
||||||
// Only update if contents have changed
|
// Only update if contents have changed
|
||||||
if( params != inset_->params() ) {
|
if(params != inset_->params()) {
|
||||||
inset_->setParams( params );
|
inset_->setParams(params);
|
||||||
lv_->view()->updateInset( inset_, true );
|
lv_->view()->updateInset(inset_, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lv_->getLyXFunc()->Dispatch( LFUN_CITATION_INSERT,
|
lv_->getLyXFunc()->Dispatch(LFUN_CITATION_INSERT,
|
||||||
params.getAsString().c_str() );
|
params.getAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,19 +83,18 @@ void FormIndex::update()
|
|||||||
|
|
||||||
void FormIndex::apply()
|
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
|
// Only update if contents have changed
|
||||||
if( params != inset_->params() ) {
|
if (params != inset_->params()) {
|
||||||
inset_->setParams( params );
|
inset_->setParams(params);
|
||||||
lv_->view()->updateInset( inset_, true );
|
lv_->view()->updateInset(inset_, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lv_->getLyXFunc()->Dispatch( LFUN_INDEX_INSERT,
|
lv_->getLyXFunc()->Dispatch(LFUN_INDEX_INSERT,
|
||||||
params.getAsString().c_str() );
|
params.getAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,21 +234,20 @@ void FormRef::apply()
|
|||||||
if (!lv_->view()->available())
|
if (!lv_->view()->available())
|
||||||
return;
|
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.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
|
// Only update if contents have changed
|
||||||
if( params != inset_->params() ) {
|
if(params != inset_->params()) {
|
||||||
inset_->setParams( params );
|
inset_->setParams(params);
|
||||||
lv_->view()->updateInset( inset_, true );
|
lv_->view()->updateInset(inset_, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lv_->getLyXFunc()->Dispatch( LFUN_REF_INSERT,
|
lv_->getLyXFunc()->Dispatch(LFUN_REF_INSERT,
|
||||||
params.getAsString().c_str() );
|
params.getAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,12 +261,12 @@ void FormRef::input( long data )
|
|||||||
toggle = static_cast<Goto>(toggle + 1);
|
toggle = static_cast<Goto>(toggle + 1);
|
||||||
if( toggle == GOFIRST ) toggle = GOREF;
|
if( toggle == GOFIRST ) toggle = GOREF;
|
||||||
|
|
||||||
switch( toggle ) {
|
switch (toggle) {
|
||||||
case GOREF:
|
case GOREF:
|
||||||
{
|
{
|
||||||
lv_->getLyXFunc()->
|
lv_->getLyXFunc()->
|
||||||
Dispatch(LFUN_REF_GOTO,
|
Dispatch(LFUN_REF_GOTO,
|
||||||
params.getContents().c_str());
|
params.getContents());
|
||||||
fl_set_object_label(dialog_->go, _("Go back"));
|
fl_set_object_label(dialog_->go, _("Go back"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -146,9 +146,9 @@ void FormToc::apply()
|
|||||||
|
|
||||||
updateToc();
|
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()) {
|
if (0 < choice && choice - 1 < toclist.size()) {
|
||||||
string tmp = tostr(toclist[choice-1].par->id());
|
string const tmp = tostr(toclist[choice-1].par->id());
|
||||||
lv_->getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tmp.c_str());
|
lv_->getLyXFunc()->Dispatch(LFUN_GOTO_PARAGRAPH, tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,25 +93,24 @@ void FormUrl::update()
|
|||||||
|
|
||||||
void FormUrl::apply()
|
void FormUrl::apply()
|
||||||
{
|
{
|
||||||
if( lv_->buffer()->isReadonly() ) return;
|
if(lv_->buffer()->isReadonly()) return;
|
||||||
|
|
||||||
params.setContents( fl_get_input(dialog_->url) );
|
params.setContents(fl_get_input(dialog_->url));
|
||||||
params.setOptions( fl_get_input(dialog_->name) );
|
params.setOptions(fl_get_input(dialog_->name));
|
||||||
|
|
||||||
if (fl_get_button(dialog_->radio_html))
|
if (fl_get_button(dialog_->radio_html))
|
||||||
params.setCmdName("htmlurl");
|
params.setCmdName("htmlurl");
|
||||||
else
|
else
|
||||||
params.setCmdName("url");
|
params.setCmdName("url");
|
||||||
|
|
||||||
if( inset_ != 0 )
|
if(inset_ != 0) {
|
||||||
{
|
|
||||||
// Only update if contents have changed
|
// Only update if contents have changed
|
||||||
if( params != inset_->params() ) {
|
if(params != inset_->params()) {
|
||||||
inset_->setParams( params );
|
inset_->setParams(params);
|
||||||
lv_->view()->updateInset( inset_, true );
|
lv_->view()->updateInset(inset_, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lv_->getLyXFunc()->Dispatch( LFUN_INSERT_URL,
|
lv_->getLyXFunc()->Dispatch(LFUN_INSERT_URL,
|
||||||
params.getAsString().c_str() );
|
params.getAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ void include_cb(FL_OBJECT *, long arg)
|
|||||||
|
|
||||||
fl_hide_form(form->include);
|
fl_hide_form(form->include);
|
||||||
current_view->updateInset(inset, true);
|
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;
|
break;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ string const InsetParent::getScreenLabel() const
|
|||||||
void InsetParent::Edit(BufferView * bv, int, int, unsigned int)
|
void InsetParent::Edit(BufferView * bv, int, int, unsigned int)
|
||||||
{
|
{
|
||||||
bv->owner()->getLyXFunc()->
|
bv->owner()->getLyXFunc()->
|
||||||
Dispatch(LFUN_CHILDOPEN, getContents().c_str());
|
Dispatch(LFUN_CHILDOPEN, getContents());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ void InsetRef::Edit(BufferView * bv, int, int, unsigned int button)
|
|||||||
// Eventually trigger dialog with button 3 not 1
|
// Eventually trigger dialog with button 3 not 1
|
||||||
if( button == 3 )
|
if( button == 3 )
|
||||||
bv->owner()->getLyXFunc()->
|
bv->owner()->getLyXFunc()->
|
||||||
Dispatch(LFUN_REF_GOTO, getContents().c_str());
|
Dispatch(LFUN_REF_GOTO, getContents());
|
||||||
else if( button == 1 )
|
else if( button == 1 )
|
||||||
bv->owner()->getDialogs()->showRef( this );
|
bv->owner()->getDialogs()->showRef( this );
|
||||||
}
|
}
|
||||||
|
@ -1178,7 +1178,7 @@ void LayoutsCB(int sel, void *, Combox *)
|
|||||||
{
|
{
|
||||||
string tmp = tostr(sel);
|
string tmp = tostr(sel);
|
||||||
current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
|
current_view->owner()->getLyXFunc()->Dispatch(LFUN_LAYOUTNO,
|
||||||
tmp.c_str());
|
tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NEW_EXPORT
|
#ifndef NEW_EXPORT
|
||||||
|
@ -298,7 +298,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
|
|||||||
|
|
||||||
bool tmp_sc = show_sc;
|
bool tmp_sc = show_sc;
|
||||||
show_sc = false;
|
show_sc = false;
|
||||||
Dispatch(action, argument.c_str());
|
Dispatch(action, argument);
|
||||||
show_sc = tmp_sc;
|
show_sc = tmp_sc;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -432,7 +432,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
|
|||||||
|
|
||||||
bool tmp_sc = show_sc;
|
bool tmp_sc = show_sc;
|
||||||
show_sc = false;
|
show_sc = false;
|
||||||
Dispatch(action, argument.c_str());
|
Dispatch(action, argument);
|
||||||
show_sc = tmp_sc;
|
show_sc = tmp_sc;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -650,10 +650,11 @@ LyXFunc::func_status LyXFunc::getStatus(int ac) const
|
|||||||
string const LyXFunc::Dispatch(string const & s)
|
string const LyXFunc::Dispatch(string const & s)
|
||||||
{
|
{
|
||||||
// Split command string into command and argument
|
// 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, ' ')));
|
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),
|
Dispatch(int(LFUN_LAYOUT),
|
||||||
textclasslist.NameOfLayout(owner->view()
|
textclasslist.NameOfLayout(owner->view()
|
||||||
->buffer()->params.textclass,
|
->buffer()->params.textclass,
|
||||||
sel).c_str());
|
sel));
|
||||||
return string();
|
return string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
|
|||||||
string rval, buf;
|
string rval, buf;
|
||||||
|
|
||||||
if (action>= 0) {
|
if (action>= 0) {
|
||||||
rval = serv->func->Dispatch(action, arg.c_str());
|
rval = serv->func->Dispatch(action, arg);
|
||||||
} else {
|
} else {
|
||||||
rval = "Unknown command";
|
rval = "Unknown command";
|
||||||
}
|
}
|
||||||
|
11
src/main.C
11
src/main.C
@ -9,7 +9,6 @@
|
|||||||
* ====================================================== */
|
* ====================================================== */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "lyx_main.h"
|
#include "lyx_main.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -17,14 +16,10 @@
|
|||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "frontends/GUIRunTime.h"
|
#include "frontends/GUIRunTime.h"
|
||||||
|
|
||||||
using std::cerr;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
GUIRunTime guiruntime;
|
|
||||||
|
|
||||||
int main(int argc, char * argv[])
|
int main(int argc, char * argv[])
|
||||||
{
|
{
|
||||||
int val = guiruntime.initApplication(argc, argv);
|
int const val = GUIRunTime::initApplication(argc, argv);
|
||||||
if (val)
|
if (val)
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
@ -35,8 +30,8 @@ int main(int argc, char * argv[])
|
|||||||
lyx_localedir = LOCALEDIR;
|
lyx_localedir = LOCALEDIR;
|
||||||
|
|
||||||
// initialize for internationalized version *EK*
|
// initialize for internationalized version *EK*
|
||||||
locale_init();
|
locale_init(); // macro
|
||||||
gettext_init();
|
gettext_init(); // macro
|
||||||
|
|
||||||
#ifdef __EMX__
|
#ifdef __EMX__
|
||||||
_wildcard(&argc, &argv);
|
_wildcard(&argc, &argv);
|
||||||
|
@ -141,8 +141,8 @@ void button_cb(FL_OBJECT * ob, long data)
|
|||||||
/* callbacks for form delim */
|
/* callbacks for form delim */
|
||||||
void delim_cb(FL_OBJECT *, long data)
|
void delim_cb(FL_OBJECT *, long data)
|
||||||
{
|
{
|
||||||
int left= fd_delim->left->u_ldata, right= fd_delim->right->u_ldata;
|
int left = fd_delim->left->u_ldata, right= fd_delim->right->u_ldata;
|
||||||
int side= (fl_get_button(fd_delim->right)!= 0);
|
int side = (fl_get_button(fd_delim->right)!= 0);
|
||||||
|
|
||||||
switch (data) {
|
switch (data) {
|
||||||
case MM_APPLY:
|
case MM_APPLY:
|
||||||
|
@ -77,7 +77,7 @@ private:
|
|||||||
///
|
///
|
||||||
mutable int history_cnt;
|
mutable int history_cnt;
|
||||||
///
|
///
|
||||||
void addHistory(string const &cmd) const {
|
void addHistory(string const & cmd) const {
|
||||||
if (history_cnt == 0
|
if (history_cnt == 0
|
||||||
|| (history_cnt > 0
|
|| (history_cnt > 0
|
||||||
&& cmd != history[(history_cnt - 1) % MAX_HISTORY])) {
|
&& cmd != history[(history_cnt - 1) % MAX_HISTORY])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user