diff options
Diffstat (limited to 'Dalos')
-rw-r--r-- | Dalos/Console.cc | 24 | ||||
-rw-r--r-- | Dalos/Console.h | 8 | ||||
-rw-r--r-- | Dalos/Dalos.cc | 3 |
3 files changed, 21 insertions, 14 deletions
diff --git a/Dalos/Console.cc b/Dalos/Console.cc index 1cc2b08..f4d914b 100644 --- a/Dalos/Console.cc +++ b/Dalos/Console.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Console.cc,v 1.2 2004-11-27 21:47:23 pixel Exp $ */ +/* $Id: Console.cc,v 1.3 2004-12-26 02:45:55 pixel Exp $ */ #include <SDL.h> #include <SDL_thread.h> @@ -31,6 +31,8 @@ #include <glshape.h> +#include <font.h> + #include <Console.h> SDL_mutex * console_lock; @@ -93,9 +95,9 @@ class ReadLineInternals : public Base { if (runit) { SDL_SemPost(console_sem); - prompt = "> "; + console_prompt = "> "; } else { - prompt = "- "; + console_prompt = "- "; } line = endline.trim(); } @@ -127,12 +129,12 @@ class ReadLineInternals : public Base { } }; -virtual void console_keyevent::down(SDL_keysym k) { - if (Application->Console->GetVisible()) { +void console_keyevent::down(SDL_keysym k) { + if (CurrentConsole->GetVisible()) { SDL_mutexP(key_vect_mutex); switch (k.sym) { case SDLK_ESCAPE: - Application->Console->SetVisible(false); + CurrentConsole->SetVisible(false); SDL_mutexV(key_vect_mutex); return; case SDLK_DELETE: @@ -157,11 +159,11 @@ virtual void console_keyevent::down(SDL_keysym k) { key_vect.push_back('E' - '@'); break; case SDLK_PAGEUP: - Application->Console->page_up(); + CurrentConsole->page_up(); SDL_mutexV(key_vect_mutex); return; case SDLK_PAGEDOWN: - Application->Console->page_down(); + CurrentConsole->page_down(); SDL_mutexV(key_vect_mutex); return; case SDLK_c: @@ -292,7 +294,7 @@ void console::draw() { mogltk::ColorP::Max.A = 255; mogltk::FixedFont->putcursor(GetAX(), GetAY() + (nlines - 1) * 13); - mogltk::FixedFont->printf(prompt); + mogltk::FixedFont->printf(console_prompt); mogltk::FixedFont->printf("%s", rl_line_buffer + start); } } @@ -301,9 +303,9 @@ bool console::process_event(int mx, int my, mogltk::event_t event) { return false; } -void create_console_thread { +void console::create_console_thread() { key_vect_mutex = SDL_CreateMutex(); key_vect_size = SDL_CreateSemaphore(0); - SDL_CreateThread(readline_thread, 0); + SDL_CreateThread(ReadLineInternals::readline_thread, 0); } diff --git a/Dalos/Console.h b/Dalos/Console.h index 8073a4d..65e8357 100644 --- a/Dalos/Console.h +++ b/Dalos/Console.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Console.h,v 1.2 2004-11-27 21:47:23 pixel Exp $ */ +/* $Id: Console.h,v 1.3 2004-12-26 02:45:55 pixel Exp $ */ #ifndef __CONSOLE_H__ #define __CONSOLE_H__ @@ -44,6 +44,7 @@ class console : public mogltk::widget { void page_reset(); void page_up(); void page_down(); + static void create_console_thread(); protected: virtual void draw(); virtual bool process_event(int mx, int my, mogltk::event_t event); @@ -53,11 +54,14 @@ class console : public mogltk::widget { SDL_mutex * protect_add_line; } * CurrentConsole; +// We should rather have a special mechanism for these extern SDL_mutex * console_lock; extern SDL_sem * console_sem; extern Buffer console_buffer; - extern String console_prompt; +// Really extern... They have to be provided (sigh) +extern bool auto_exec, lua_started, do_lua_break; + #endif diff --git a/Dalos/Dalos.cc b/Dalos/Dalos.cc index fb99b3b..3697fc1 100644 --- a/Dalos/Dalos.cc +++ b/Dalos/Dalos.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: Dalos.cc,v 1.10 2004-12-25 22:58:20 pixel Exp $ */
+/* $Id: Dalos.cc,v 1.11 2004-12-26 02:45:55 pixel Exp $ */
#include <SDL.h>
#include <SDL_thread.h>
@@ -490,6 +490,7 @@ virtual int startup() throw (GeneralException) { (new hexview(sh, box->InnerPanel()))->bind_handle(new Input(argv[0]));
CurrentConsole = new console(sh, Root, 0, 8);
+ console::create_console_thread();
CurrentConsole->move(0, Root->GetH() - CurrentConsole->GetH());
CurrentConsole->add_line("Dalos v0.1 - LUA console");
|