mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 18:52:46 +00:00
some small cleanups
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4895 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2266b53c87
commit
ba29fec6bf
@ -1,3 +1,13 @@
|
|||||||
|
2002-08-08 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
|
* funcrequest.h: just tedious nonsense
|
||||||
|
|
||||||
|
* lyx_main.h:
|
||||||
|
* lyx_main.C: cleanups
|
||||||
|
|
||||||
|
* buffer.C:
|
||||||
|
* vspace.C: remove dead header lyx_main.h
|
||||||
|
|
||||||
2002-08-07 John Levon <levon@movementarian.org>
|
2002-08-07 John Levon <levon@movementarian.org>
|
||||||
|
|
||||||
* BufferView_pimpl.C (resizeCurrentBuffer): update scrollbar
|
* BufferView_pimpl.C (resizeCurrentBuffer): update scrollbar
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "bufferlist.h"
|
#include "bufferlist.h"
|
||||||
#include "lyx_main.h"
|
|
||||||
#include "LyXAction.h"
|
#include "LyXAction.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxlex.h"
|
#include "lyxlex.h"
|
||||||
|
@ -1,30 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* \file funcrequest.h
|
||||||
|
* Copyright 2002 the LyX Team
|
||||||
|
* Read the file COPYING
|
||||||
|
*
|
||||||
|
* \author André Pönitz
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef FUNCREQUEST_H
|
#ifndef FUNCREQUEST_H
|
||||||
#define FUNCREQUEST_H
|
#define FUNCREQUEST_H
|
||||||
|
|
||||||
#include "commandtags.h"
|
#include "commandtags.h"
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
|
||||||
/** This class encapsulates LyX action and arguemnt
|
/**
|
||||||
* in order to passs it around easily.
|
* This class encapsulates a LyX action and its argument
|
||||||
|
* in order to pass it around easily.
|
||||||
*/
|
*/
|
||||||
struct FuncRequest {
|
struct FuncRequest {
|
||||||
///
|
|
||||||
FuncRequest()
|
FuncRequest()
|
||||||
: action(LFUN_UNKNOWN_ACTION)
|
: action(LFUN_UNKNOWN_ACTION)
|
||||||
{}
|
{}
|
||||||
///
|
|
||||||
FuncRequest(kb_action act)
|
FuncRequest(kb_action act)
|
||||||
: action(act)
|
: action(act)
|
||||||
{}
|
{}
|
||||||
///
|
|
||||||
FuncRequest(kb_action act, string const & arg)
|
FuncRequest(kb_action act, string const & arg)
|
||||||
: action(act), argument(arg)
|
: action(act), argument(arg)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
///
|
/// the action
|
||||||
kb_action action;
|
kb_action action;
|
||||||
///
|
/// the action's string argument
|
||||||
string argument;
|
string argument;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // FUNCREQUEST_H
|
||||||
|
256
src/lyx_main.C
256
src/lyx_main.C
@ -40,6 +40,8 @@
|
|||||||
#include "frontends/Alert.h"
|
#include "frontends/Alert.h"
|
||||||
#include "frontends/lyx_gui.h"
|
#include "frontends/lyx_gui.h"
|
||||||
|
|
||||||
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
|
|
||||||
@ -153,8 +155,7 @@ LyX::LyX(int & argc, char * argv[])
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
static
|
static void error_handler(int err_sig)
|
||||||
void error_handler(int err_sig)
|
|
||||||
{
|
{
|
||||||
switch (err_sig) {
|
switch (err_sig) {
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
@ -200,7 +201,6 @@ void error_handler(int err_sig)
|
|||||||
|
|
||||||
void LyX::init(bool gui)
|
void LyX::init(bool gui)
|
||||||
{
|
{
|
||||||
// Install the signal handlers
|
|
||||||
signal(SIGHUP, error_handler);
|
signal(SIGHUP, error_handler);
|
||||||
signal(SIGFPE, error_handler);
|
signal(SIGFPE, error_handler);
|
||||||
signal(SIGSEGV, error_handler);
|
signal(SIGSEGV, error_handler);
|
||||||
@ -247,7 +247,6 @@ void LyX::init(bool gui)
|
|||||||
if (!system_lyxdir.empty())
|
if (!system_lyxdir.empty())
|
||||||
searchpath = MakeAbsPath(system_lyxdir) + ';';
|
searchpath = MakeAbsPath(system_lyxdir) + ';';
|
||||||
|
|
||||||
// LYX_DIR_13x environment variable
|
|
||||||
string const lyxdir = GetEnvPath("LYX_DIR_13x");
|
string const lyxdir = GetEnvPath("LYX_DIR_13x");
|
||||||
|
|
||||||
if (!lyxdir.empty()) {
|
if (!lyxdir.empty()) {
|
||||||
@ -311,7 +310,6 @@ void LyX::init(bool gui)
|
|||||||
// Hardcoded dir
|
// Hardcoded dir
|
||||||
searchpath += LYX_DIR;
|
searchpath += LYX_DIR;
|
||||||
|
|
||||||
// If debugging, show complete search path
|
|
||||||
lyxerr[Debug::INIT] << "System directory search path: "
|
lyxerr[Debug::INIT] << "System directory search path: "
|
||||||
<< searchpath << endl;
|
<< searchpath << endl;
|
||||||
|
|
||||||
@ -358,7 +356,7 @@ void LyX::init(bool gui)
|
|||||||
system_lyxdir = LYX_DIR;
|
system_lyxdir = LYX_DIR;
|
||||||
path_shown = true;
|
path_shown = true;
|
||||||
}
|
}
|
||||||
// Report the system directory if debugging is on
|
|
||||||
if (!path_shown)
|
if (!path_shown)
|
||||||
lyxerr[Debug::INIT] << "System directory: '"
|
lyxerr[Debug::INIT] << "System directory: '"
|
||||||
<< system_lyxdir << '\'' << endl;
|
<< system_lyxdir << '\'' << endl;
|
||||||
@ -430,9 +428,7 @@ void LyX::init(bool gui)
|
|||||||
if (!readRcFile("preferences"))
|
if (!readRcFile("preferences"))
|
||||||
readRcFile("lyxrc");
|
readRcFile("lyxrc");
|
||||||
|
|
||||||
// Read encodings
|
|
||||||
readEncodingsFile("encodings");
|
readEncodingsFile("encodings");
|
||||||
// Read languages
|
|
||||||
readLanguagesFile("languages");
|
readLanguagesFile("languages");
|
||||||
|
|
||||||
// Load the layouts
|
// Load the layouts
|
||||||
@ -455,14 +451,12 @@ void LyX::init(bool gui)
|
|||||||
lyxrc.print();
|
lyxrc.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create temp directory
|
|
||||||
os::setTmpDir(CreateLyXTmpDir(lyxrc.tempdir_path));
|
os::setTmpDir(CreateLyXTmpDir(lyxrc.tempdir_path));
|
||||||
system_tempdir = os::getTmpDir();
|
system_tempdir = os::getTmpDir();
|
||||||
if (lyxerr.debugging(Debug::INIT)) {
|
if (lyxerr.debugging(Debug::INIT)) {
|
||||||
lyxerr << "LyX tmp dir: `" << system_tempdir << '\'' << endl;
|
lyxerr << "LyX tmp dir: `" << system_tempdir << '\'' << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the lastfiles mini-database
|
|
||||||
lyxerr[Debug::INIT] << "Reading lastfiles `"
|
lyxerr[Debug::INIT] << "Reading lastfiles `"
|
||||||
<< lyxrc.lastfiles << "'..." << endl;
|
<< lyxrc.lastfiles << "'..." << endl;
|
||||||
lastfiles.reset(new LastFiles(lyxrc.lastfiles,
|
lastfiles.reset(new LastFiles(lyxrc.lastfiles,
|
||||||
@ -471,7 +465,6 @@ void LyX::init(bool gui)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// These are the default bindings known to LyX
|
|
||||||
void LyX::defaultKeyBindings(kb_keymap * kbmap)
|
void LyX::defaultKeyBindings(kb_keymap * kbmap)
|
||||||
{
|
{
|
||||||
kbmap->bind("Right", LFUN_RIGHT);
|
kbmap->bind("Right", LFUN_RIGHT);
|
||||||
@ -543,7 +536,6 @@ void LyX::emergencyCleanup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// LyX can optionally take over the handling of deadkeys
|
|
||||||
void LyX::deadKeyBindings(kb_keymap * kbmap)
|
void LyX::deadKeyBindings(kb_keymap * kbmap)
|
||||||
{
|
{
|
||||||
// bindKeyings for transparent handling of deadkeys
|
// bindKeyings for transparent handling of deadkeys
|
||||||
@ -570,8 +562,6 @@ void LyX::deadKeyBindings(kb_keymap * kbmap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This one is not allowed to use anything on the main form, since that
|
|
||||||
// one does not exist yet. (Asger)
|
|
||||||
void LyX::queryUserLyXDir(bool explicit_userdir)
|
void LyX::queryUserLyXDir(bool explicit_userdir)
|
||||||
{
|
{
|
||||||
// Does user directory exist?
|
// Does user directory exist?
|
||||||
@ -579,11 +569,11 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
|
|||||||
if (fileInfo.isOK() && fileInfo.isDir()) {
|
if (fileInfo.isOK() && fileInfo.isDir()) {
|
||||||
first_start = false;
|
first_start = false;
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
first_start = !explicit_userdir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the user specified explicitely a directory, ask whether
|
first_start = !explicit_userdir;
|
||||||
|
|
||||||
|
// If the user specified explicitly a directory, ask whether
|
||||||
// to create it (otherwise, always create it)
|
// to create it (otherwise, always create it)
|
||||||
if (explicit_userdir &&
|
if (explicit_userdir &&
|
||||||
!Alert::askQuestion(_("You have specified an invalid LyX directory."),
|
!Alert::askQuestion(_("You have specified an invalid LyX directory."),
|
||||||
@ -595,11 +585,9 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tell the user what is going on
|
|
||||||
lyxerr << _("LyX: Creating directory ") << user_lyxdir
|
lyxerr << _("LyX: Creating directory ") << user_lyxdir
|
||||||
<< _(" and running configure...") << endl;
|
<< _(" and running configure...") << endl;
|
||||||
|
|
||||||
// Create directory structure
|
|
||||||
if (!createDirectory(user_lyxdir, 0755)) {
|
if (!createDirectory(user_lyxdir, 0755)) {
|
||||||
// Failed, let's use $HOME instead.
|
// Failed, let's use $HOME instead.
|
||||||
user_lyxdir = GetEnvPath("HOME");
|
user_lyxdir = GetEnvPath("HOME");
|
||||||
@ -615,7 +603,6 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Read the rc file `name'
|
|
||||||
bool LyX::readRcFile(string const & name)
|
bool LyX::readRcFile(string const & name)
|
||||||
{
|
{
|
||||||
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
|
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
|
||||||
@ -726,17 +713,26 @@ void LyX::readEncodingsFile(string const & name)
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// Set debugging level and report result to user
|
bool is_gui = true;
|
||||||
void setDebuggingLevel(string const & dbgLevel)
|
string batch;
|
||||||
|
|
||||||
|
/// return the the number of arguments consumed
|
||||||
|
typedef boost::function<int, string const &, string const &> cmd_helper;
|
||||||
|
|
||||||
|
int parse_dbg(string const & arg, string const &)
|
||||||
{
|
{
|
||||||
lyxerr << _("Setting debug level to ") << dbgLevel << endl;
|
if (arg.empty()) {
|
||||||
lyxerr.level(Debug::value(dbgLevel));
|
lyxerr << _("List of supported debug flags:") << endl;
|
||||||
|
Debug::showTags(lyxerr);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
lyxerr << _("Setting debug level to ") << arg << endl;
|
||||||
|
lyxerr.level(Debug::value(arg));
|
||||||
Debug::showLevel(lyxerr, lyxerr.level());
|
Debug::showLevel(lyxerr, lyxerr.level());
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int parse_help(string const &, string const &)
|
||||||
// Give command line help
|
|
||||||
void commandLineHelp()
|
|
||||||
{
|
{
|
||||||
lyxerr <<
|
lyxerr <<
|
||||||
_("Usage: lyx [ command line switches ] [ name.lyx ... ]\n"
|
_("Usage: lyx [ command line switches ] [ name.lyx ... ]\n"
|
||||||
@ -757,141 +753,125 @@ void commandLineHelp()
|
|||||||
" and file.xxx is the file to be imported.\n"
|
" and file.xxx is the file to be imported.\n"
|
||||||
"\t-version summarize version and build info\n"
|
"\t-version summarize version and build info\n"
|
||||||
"Check the LyX man page for more details.") << endl;
|
"Check the LyX man page for more details.") << endl;
|
||||||
|
exit(0);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give command line version information
|
int parse_version(string const &, string const &)
|
||||||
void commandLineVersionInfo()
|
|
||||||
{
|
{
|
||||||
lyxerr << "LyX " << lyx_version
|
lyxerr << "LyX " << lyx_version
|
||||||
<< " of " << lyx_release_date << endl;
|
<< " of " << lyx_release_date << endl;
|
||||||
lyxerr << "Built on " << __DATE__ << ", " << __TIME__ << endl;
|
lyxerr << "Built on " << __DATE__ << ", " << __TIME__ << endl;
|
||||||
|
|
||||||
lyxerr << lyx_version_info << endl;
|
lyxerr << lyx_version_info << endl;
|
||||||
|
exit(0);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int parse_sysdir(string const & arg, string const &)
|
||||||
|
{
|
||||||
|
if (arg.empty()) {
|
||||||
|
lyxerr << _("Missing directory for -sysdir switch") << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
system_lyxdir = arg;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int parse_userdir(string const & arg, string const &)
|
||||||
|
{
|
||||||
|
if (arg.empty()) {
|
||||||
|
lyxerr << _("Missing directory for -userdir switch") << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
user_lyxdir = arg;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int parse_execute(string const & arg, string const &)
|
||||||
|
{
|
||||||
|
if (arg.empty()) {
|
||||||
|
lyxerr << _("Missing command string after --execute switch") << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
batch = arg;
|
||||||
|
// Argh. Setting gui to false segfaults..
|
||||||
|
// FIXME: when ? how ?
|
||||||
|
// is_gui = false;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int parse_export(string const & type, string const &)
|
||||||
|
{
|
||||||
|
if (type.empty()) {
|
||||||
|
lyxerr << _("Missing file type [eg latex, ps...] after "
|
||||||
|
"--export switch") << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
batch = "buffer-export " + type;
|
||||||
|
is_gui = false;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int parse_import(string const & type, string const & file)
|
||||||
|
{
|
||||||
|
if (type.empty()) {
|
||||||
|
lyxerr << _("Missing file type [eg latex, ps...] after "
|
||||||
|
"--import switch") << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (file.empty()) {
|
||||||
|
lyxerr << _("Missing filename for --import") << endl;
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
batch = "buffer-import " + type + " " + file;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace anon
|
} // namespace anon
|
||||||
|
|
||||||
|
|
||||||
bool LyX::easyParse(int & argc, char * argv[])
|
bool LyX::easyParse(int & argc, char * argv[])
|
||||||
{
|
{
|
||||||
bool gui = true;
|
std::map<string, cmd_helper> cmdmap;
|
||||||
int removeargs = 0; // used when options are read
|
|
||||||
|
cmdmap["-dbg"] = parse_dbg;
|
||||||
|
cmdmap["-help"] = parse_help;
|
||||||
|
cmdmap["--help"] = parse_help;
|
||||||
|
cmdmap["-version"] = parse_version;
|
||||||
|
cmdmap["--version"] = parse_version;
|
||||||
|
cmdmap["-sysdir"] = parse_sysdir;
|
||||||
|
cmdmap["-userdir"] = parse_userdir;
|
||||||
|
cmdmap["-x"] = parse_execute;
|
||||||
|
cmdmap["--execute"] = parse_execute;
|
||||||
|
cmdmap["-e"] = parse_export;
|
||||||
|
cmdmap["--export"] = parse_export;
|
||||||
|
cmdmap["-i"] = parse_import;
|
||||||
|
cmdmap["--import"] = parse_import;
|
||||||
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
string arg = argv[i];
|
std::map<string, cmd_helper>::const_iterator it
|
||||||
|
= cmdmap.find(argv[i]);
|
||||||
|
|
||||||
// Check for -dbg int
|
// don't complain if not found - may be parsed later
|
||||||
if (arg == "-dbg") {
|
if (it == cmdmap.end())
|
||||||
if (i + 1 < argc) {
|
continue;
|
||||||
setDebuggingLevel(argv[i + 1]);
|
|
||||||
removeargs = 2;
|
|
||||||
} else {
|
|
||||||
lyxerr << _("List of supported debug flags:")
|
|
||||||
<< endl;
|
|
||||||
Debug::showTags(lyxerr);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Check for "-sysdir"
|
|
||||||
else if (arg == "-sysdir") {
|
|
||||||
if (i + 1 < argc) {
|
|
||||||
system_lyxdir = argv[i + 1];
|
|
||||||
removeargs = 2;
|
|
||||||
} else {
|
|
||||||
lyxerr << _("Missing directory for -sysdir switch!")
|
|
||||||
<< endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Check for "-userdir"
|
|
||||||
else if (arg == "-userdir") {
|
|
||||||
if (i + 1 < argc) {
|
|
||||||
user_lyxdir = argv[i + 1];
|
|
||||||
removeargs = 2;
|
|
||||||
} else {
|
|
||||||
lyxerr << _("Missing directory for -userdir switch!")
|
|
||||||
<< endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Check for --help or -help
|
|
||||||
else if (arg == "--help" || arg == "-help") {
|
|
||||||
commandLineHelp();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
// Check for --version or -version
|
|
||||||
else if (arg == "--version" || arg == "-version") {
|
|
||||||
commandLineVersionInfo();
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
// FIXME: why is this commented out ?
|
|
||||||
// Check for "-nw": No XWindows as for emacs this should
|
|
||||||
// give a LyX that could be used in a terminal window.
|
|
||||||
//else if (arg == "-nw") {
|
|
||||||
// gui = false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Check for "-x": Execute commands
|
string arg((i + 1 < argc) ? argv[i + 1] : "");
|
||||||
else if (arg == "-x" || arg == "--execute") {
|
string arg2((i + 2 < argc) ? argv[i + 2] : "");
|
||||||
if (i + 1 < argc) {
|
|
||||||
batch_command = string(argv[i + 1]);
|
|
||||||
removeargs = 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lyxerr << _("Missing command string after -x switch!") << endl;
|
|
||||||
|
|
||||||
// Argh. Setting gui to false segfaults..
|
int const remove = 1 + it->second(arg, arg2);
|
||||||
// FIXME: when ? how ?
|
|
||||||
// gui = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (arg == "-e" || arg == "--export") {
|
|
||||||
if (i + 1 < argc) {
|
|
||||||
string type(argv[i+1]);
|
|
||||||
removeargs = 2;
|
|
||||||
batch_command = "buffer-export " + type;
|
|
||||||
gui = false;
|
|
||||||
} else {
|
|
||||||
lyxerr << _("Missing file type [eg latex, "
|
|
||||||
"ps...] after ")
|
|
||||||
<< arg << _(" switch!") << endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (arg == "-i" || arg == "--import") {
|
|
||||||
if (i + 1 < argc) {
|
|
||||||
if (!argv[i+2]) {
|
|
||||||
lyxerr << _("Missing filename for --import") << endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
string const file(argv[i+2]);
|
|
||||||
string const type(argv[i+1]);
|
|
||||||
removeargs = 3;
|
|
||||||
|
|
||||||
batch_command = "buffer-import " + type + " " + file;
|
|
||||||
lyxerr << "batch_command: "
|
|
||||||
<< batch_command << endl;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
lyxerr << _("Missing type [eg latex, "
|
|
||||||
"ps...] after ")
|
|
||||||
<< arg << _(" switch!") << endl;
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (removeargs > 0) {
|
|
||||||
// Now, remove used arguments by shifting
|
// Now, remove used arguments by shifting
|
||||||
// the following ones removeargs places down.
|
// the following ones remove places down.
|
||||||
argc -= removeargs;
|
argc -= remove;
|
||||||
for (int j = i; j < argc; ++j)
|
for (int j = i; j < argc; ++j)
|
||||||
argv[j] = argv[j + removeargs];
|
argv[j] = argv[j + remove];
|
||||||
--i; // After shift, check this number again.
|
--i;
|
||||||
removeargs = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
batch_command = batch;
|
||||||
|
|
||||||
return gui;
|
return is_gui;
|
||||||
}
|
}
|
||||||
|
@ -27,16 +27,17 @@ class Buffer;
|
|||||||
class kb_keymap;
|
class kb_keymap;
|
||||||
|
|
||||||
|
|
||||||
///
|
/// e.g. $HOME/.lyx/
|
||||||
extern string user_lyxdir;
|
extern string user_lyxdir;
|
||||||
///
|
/// e.g. /usr/share/lyx/
|
||||||
extern string system_lyxdir;
|
extern string system_lyxdir;
|
||||||
///
|
/// e.g. /tmp
|
||||||
extern string system_tempdir;
|
extern string system_tempdir;
|
||||||
///
|
/// last files loaded
|
||||||
extern boost::scoped_ptr<LastFiles> lastfiles;
|
extern boost::scoped_ptr<LastFiles> lastfiles;
|
||||||
|
|
||||||
|
|
||||||
|
/// initial startup
|
||||||
class LyX : boost::noncopyable {
|
class LyX : boost::noncopyable {
|
||||||
public:
|
public:
|
||||||
LyX(int & argc, char * argv[]);
|
LyX(int & argc, char * argv[]);
|
||||||
@ -45,32 +46,29 @@ public:
|
|||||||
static void emergencyCleanup();
|
static void emergencyCleanup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// does this user start lyx for the first time?
|
/// initial LyX set up
|
||||||
bool first_start;
|
|
||||||
///
|
|
||||||
string batch_command;
|
|
||||||
///
|
|
||||||
void runtime();
|
|
||||||
///
|
|
||||||
void init(bool);
|
void init(bool);
|
||||||
///
|
/// set up the default key bindings
|
||||||
void defaultKeyBindings(kb_keymap * kbmap);
|
void defaultKeyBindings(kb_keymap * kbmap);
|
||||||
///
|
/// set up the default dead key bindings if requested
|
||||||
void deadKeyBindings(kb_keymap * kbmap);
|
void deadKeyBindings(kb_keymap * kbmap);
|
||||||
///
|
/// check, set up and configure the user dir if necessary
|
||||||
void queryUserLyXDir(bool explicit_userdir);
|
void queryUserLyXDir(bool explicit_userdir);
|
||||||
/** Search for and read the LyXRC file name, return
|
/// return true if the given prefs file was successfully read
|
||||||
true if successfull.
|
|
||||||
*/
|
|
||||||
bool readRcFile(string const & name);
|
bool readRcFile(string const & name);
|
||||||
/// Read the ui file `name'
|
/// read the given ui (menu/toolbar) file
|
||||||
void readUIFile(string const & name);
|
void readUIFile(string const & name);
|
||||||
/// Read the languages file `name'
|
/// read the given languages file
|
||||||
void readLanguagesFile(string const & name);
|
void readLanguagesFile(string const & name);
|
||||||
/// Read the encodings file `name'
|
/// read the given encodings file
|
||||||
void readEncodingsFile(string const & name);
|
void readEncodingsFile(string const & name);
|
||||||
///
|
/// parsing of non-gui LyX options. Returns true if gui
|
||||||
bool easyParse(int & argc, char * argv[]);
|
bool easyParse(int & argc, char * argv[]);
|
||||||
|
|
||||||
|
/// has this user started lyx for the first time?
|
||||||
|
bool first_start;
|
||||||
|
/// the parsed command line batch command if any
|
||||||
|
string batch_command;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // LYX_MAIN_H
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "math_mathmlstream.h"
|
#include "math_mathmlstream.h"
|
||||||
#include "textpainter.h"
|
#include "textpainter.h"
|
||||||
|
|
||||||
#include "lyx_main.h"
|
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include "vspace.h"
|
#include "vspace.h"
|
||||||
#include "lengthcommon.h"
|
#include "lengthcommon.h"
|
||||||
#include "lyx_main.h"
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user