lyx_mirror/src/frontends/lyx_gui.h
Georg Baum 042d5a0242 Fix crash on exit (bug 2549) by correct usage of QApplication
* src/lyx_cb.C
	(quitLyX): lyx_gui::exit takes now an argument

	* src/frontends/{gtk,xforms}/lyx_gui.C
	(lyx_gui::parse_init): rename to lyx_gui::exec and call LyX::exec2
	(void lyx_gui::exit): add exit status argument

	* src/frontends/qt{3,4}/lyx_gui.C
	(cleanup): new function for pointer cleanup
	(lyx_gui::parse_init): rename to lyx_gui::exec and call LyX::exec2,
	turn static variables into automatic variables
	(void lyx_gui::exit): add exit status argument
	(start): Use cleanup()
	(exit): ditto

	* src/frontends/lyx_gui.h
	(parse_init): remove
	(exec): new
	(exit): Take exist status argument

	* src/lyx_main.[Ch]
	(LyX::priv_exec): split into LyX::priv_exec and LyX::exec2

	* src/lyx_main.C
	(lyx_exit): New, choose the right exit function
	(showFileError): call lyx_exit
	(LyX::queryUserLyXDir): ditto
	(LyX::init): ditto
	(LyX::priv_exec): ditto
	(LyX::priv_exec): Replace want_gui by lyx_gui::use_gui
	(LyX::priv_exec): replace lyx_gui::parse_init by lyx_gui::exec and
	exec2
	(LyX::init): Replace gui argument by lyx_gui::use_gui


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14036 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-07 20:08:37 +00:00

125 lines
2.6 KiB
C++

// -*- C++ -*-
/**
* \file lyx_gui.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author John Levon
*
* Full author contact details are available in file CREDITS.
*/
#ifndef LYX_GUI_H
#define LYX_GUI_H
#include "FuncStatus.h"
#include <boost/function.hpp>
#include <string>
#include <vector>
class Dialogs;
class LColor_color;
class LyXFont;
class LyXComm;
class LyXDataSocket;
class LyXServerSocket;
class FuncRequest;
namespace lyx {
struct RGBColor;
}
/// GUI interaction
namespace lyx_gui {
/// are we using the GUI at all
extern bool use_gui;
/// return a suitable serif font name (called from non-gui context too !)
std::string const roman_font_name();
/// return a suitable sans serif font name (called from non-gui context too !)
std::string const sans_font_name();
/// return a suitable monospaced font name (called from non-gui context too !)
std::string const typewriter_font_name();
/**
* set up GUI parameters. At this point lyxrc may
* be used.
*/
void parse_lyxrc();
/**
* Start the main event loop, after executing the given
* batch commands, and loading the given documents
*/
void start(std::string const & batch, std::vector<std::string> const & files,
unsigned int width, unsigned int height, int posx, int posy);
/**
* Enter the main event loop (\sa LyX::exec2)
*/
void exec(int & argc, char * argv[]);
/**
* Synchronise all pending events.
*/
void sync_events();
/**
* quit running LyX
*/
void exit(int);
/**
* return the status flag for a given action. This can be used to tell
* that a given lfun is not implemented by a frontend
*/
FuncStatus getStatus(FuncRequest const & ev);
/**
* Given col, fills r, g, b in the range 0-255.
* The function returns true if successful.
* It returns false on failure and sets r, g, b to 0.
*/
bool getRGBColor(LColor_color col, lyx::RGBColor & rgbcol);
/** Eg, passing LColor::black returns "000000",
* passing LColor::white returns "ffffff".
*/
std::string const hexname(LColor_color col);
/**
* update an altered GUI color
*/
void update_color(LColor_color col);
/**
* update the font cache
*/
void update_fonts();
/**
* is the given font available ?
*/
bool font_available(LyXFont const & font);
/**
* add a callback for socket read notification
* @param fd socket descriptor (file/socket/etc)
*/
void register_socket_callback(int fd, boost::function<void()> func);
/**
* remove a I/O read callback
* @param fd socket descriptor (file/socket/etc)
*/
void unregister_socket_callback(int fd);
} // namespace lyx_gui
#endif // LYX_GUI_H