Пример #1
0
		unsafe internal static void Init()
		{
			Curses.initscr();
			Curses.Init();
			IntPtr ptr;

			Curses.Module.TryGetSymbol("stdscr", out ptr);
			Standard = new Window(new IntPtr(*(int *)ptr.ToPointer()));

			Curses.Module.TryGetSymbol("newscr", out ptr);
			New = new Window(new IntPtr(*(int *)ptr.ToPointer()));

			Curses.Module.TryGetSymbol("curscr", out ptr);
			Current = new Window(new IntPtr(*(int *)ptr.ToPointer()));
		}
Пример #2
0
		static public Window initscr ()
		{
			main_window = new Window (real_initscr ());
			try {
				console_sharp_get_dims (out lines, out cols);
			} catch (DllNotFoundException){
				endwin ();
				Console.Error.WriteLine ("Unable to find the libmono-curses.dylib native library\n" + 
							 "this is different than the managed mono-curses.dll\n\n" +
							 "Typically you need to install to a LD_LIBRARY_PATH directory\n" +
							 "or DYLD_LIBRARY_PATH directory or run /sbin/ldconfig");
				Environment.Exit (1);
			}
			return main_window;
		}
Пример #3
0
        /// <summary>
        ///    Initializes the runtime.   The boolean flag
        ///   indicates whether we are forcing color to be off.
        /// </summary>
        public static void Init(bool disable_color)
        {
            if (inited)
                return;
            inited = true;

            empty_container = new Container (0, 0, Application.Cols, Application.Lines);

            try {
                main_window = Curses.initscr ();
            } catch (Exception e){
                Console.WriteLine ("Curses failed to initialize, the exception is: " + e);
                throw new Exception ("Application.Init failed");
            }
            Curses.raw ();
            Curses.noecho ();
            //Curses.nonl ();
            Window.Standard.keypad (true);

            #if BREAK_UTF8_RENDERING
            Curses.Event old = 0;
            MouseEventsAvailable = Curses.console_sharp_mouse_mask (
                Curses.Event.Button1Clicked | Curses.Event.Button1DoubleClicked, out old);
            #endif

            UsingColor = false;
            if (!disable_color)
                UsingColor = Curses.has_colors ();

            Curses.start_color ();
            Curses.use_default_colors ();
            if (UsingColor){
                ColorNormal = MakeColor (Curses.COLOR_WHITE, Curses.COLOR_BLUE);
                ColorFocus = MakeColor (Curses.COLOR_BLACK, Curses.COLOR_CYAN);
                ColorHotNormal = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_BLUE);
                ColorHotFocus = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_CYAN);

                ColorMenu = Curses.A_BOLD | MakeColor (Curses.COLOR_WHITE, Curses.COLOR_CYAN);
                ColorMenuHot = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_CYAN);
                ColorMenuSelected = Curses.A_BOLD | MakeColor (Curses.COLOR_WHITE, Curses.COLOR_BLACK);
                ColorMenuHotSelected = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_BLACK);

                ColorMarked = ColorHotNormal;
                ColorMarkedSelected = ColorHotFocus;

                ColorDialogNormal    = MakeColor (Curses.COLOR_BLACK, Curses.COLOR_WHITE);
                ColorDialogFocus     = MakeColor (Curses.COLOR_BLACK, Curses.COLOR_CYAN);
                ColorDialogHotNormal = MakeColor (Curses.COLOR_BLUE,  Curses.COLOR_WHITE);
                ColorDialogHotFocus  = MakeColor (Curses.COLOR_BLUE,  Curses.COLOR_CYAN);

                ColorError = Curses.A_BOLD | MakeColor (Curses.COLOR_WHITE, Curses.COLOR_RED);
                ColorErrorFocus = MakeColor (Curses.COLOR_BLACK, Curses.COLOR_WHITE);
                ColorErrorHot = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_RED);
                ColorErrorHotFocus = ColorErrorHot;
            } else {
                ColorNormal = Curses.A_NORMAL;
                ColorFocus = Curses.A_REVERSE;
                ColorHotNormal = Curses.A_BOLD;
                ColorHotFocus = Curses.A_REVERSE | Curses.A_BOLD;

                ColorMenu = Curses.A_REVERSE;
                ColorMenuHot = Curses.A_NORMAL;
                ColorMenuSelected = Curses.A_BOLD;
                ColorMenuHotSelected = Curses.A_NORMAL;

                ColorMarked = Curses.A_BOLD;
                ColorMarkedSelected = Curses.A_REVERSE | Curses.A_BOLD;

                ColorDialogNormal = Curses.A_REVERSE;
                ColorDialogFocus = Curses.A_NORMAL;
                ColorDialogHotNormal = Curses.A_BOLD;
                ColorDialogHotFocus = Curses.A_NORMAL;

                ColorError = Curses.A_BOLD;
            }
            ColorBasic = MakeColor (-1, -1);
            mainloop = new MainLoop ();
            mainloop.AddWatch (0, MainLoop.Condition.PollIn, x => {
                Container top = toplevels.Count > 0 ? toplevels [toplevels.Count-1] : null;
                if (top != null)
                    ProcessChar (top);

                return true;
            });
        }
Пример #4
0
			internal WindowCursor(Window win)
			{
				Window = win;
			}
Пример #5
0
 public static Window initscr()
 {
     main_window = new Window (real_initscr ());
     console_sharp_get_dims (out lines, out cols);
     return main_window;
 }
Пример #6
0
		static Window ()
		{
			Curses.initscr ();
			stdscr = new Window (Curses.console_sharp_get_stdscr ());
			curscr = new Window (Curses.console_sharp_get_curscr ());
		}
Пример #7
0
        /// <summary>
        ///    Initializes the runtime.   The boolean flag
        ///   indicates whether we are forcing color to be off.
        /// </summary>
        public static void Init(bool disable_color)
        {
            empty_container = new Container (0, 0, Application.Cols, Application.Lines);

            try {
                main_window = Curses.initscr ();
            } catch (Exception e){
                Console.WriteLine ("Curses failed to initialize, the exception is: " + e);
                throw new Exception ("Application.Init failed");
            }

            if (inited)
                return;
            inited = true;

            Curses.Event old = 0;
            MouseEventsAvailable = Curses.console_sharp_mouse_mask (
                Curses.Event.Button1Clicked | Curses.Event.Button1DoubleClicked, out old);

            UsingColor = false;
            if (!disable_color)
                UsingColor = Curses.has_colors ();

            Curses.start_color ();
            Curses.use_default_colors ();
            if (UsingColor){
                ColorNormal = MakeColor (Curses.COLOR_WHITE, Curses.COLOR_BLUE);
                ColorFocus = MakeColor (Curses.COLOR_BLACK, Curses.COLOR_CYAN);
                ColorHotNormal = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_BLUE);
                ColorHotFocus = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_CYAN);

                ColorMenu = Curses.A_BOLD | MakeColor (Curses.COLOR_WHITE, Curses.COLOR_CYAN);
                ColorMenuHot = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_CYAN);
                ColorMenuSelected = Curses.A_BOLD | MakeColor (Curses.COLOR_WHITE, Curses.COLOR_BLACK);
                ColorMenuHotSelected = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_BLACK);

                ColorMarked = ColorHotNormal;
                ColorMarkedSelected = ColorHotFocus;

                ColorDialogNormal    = MakeColor (Curses.COLOR_BLACK, Curses.COLOR_WHITE);
                ColorDialogFocus     = MakeColor (Curses.COLOR_BLACK, Curses.COLOR_CYAN);
                ColorDialogHotNormal = MakeColor (Curses.COLOR_BLUE,  Curses.COLOR_WHITE);
                ColorDialogHotFocus  = MakeColor (Curses.COLOR_BLUE,  Curses.COLOR_CYAN);

                ColorError = Curses.A_BOLD | MakeColor (Curses.COLOR_WHITE, Curses.COLOR_RED);
            } else {
                ColorNormal = Curses.A_NORMAL;
                ColorFocus = Curses.A_REVERSE;
                ColorHotNormal = Curses.A_BOLD;
                ColorHotFocus = Curses.A_REVERSE | Curses.A_BOLD;

                ColorMenu = Curses.A_REVERSE;
                ColorMenuHot = Curses.A_NORMAL;
                ColorMenuSelected = Curses.A_BOLD;
                ColorMenuHotSelected = Curses.A_NORMAL;

                ColorMarked = Curses.A_BOLD;
                ColorMarkedSelected = Curses.A_REVERSE | Curses.A_BOLD;

                ColorDialogNormal = Curses.A_REVERSE;
                ColorDialogFocus = Curses.A_NORMAL;
                ColorDialogHotNormal = Curses.A_BOLD;
                ColorDialogHotFocus = Curses.A_NORMAL;

                ColorError = Curses.A_BOLD;
            }
            ColorBasic = MakeColor (-1, -1);
        }
Пример #8
0
        public static void InitializeApp()
        {
            // Build loading screen text
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("MPfm: Music Player for Musicians (v0.7.0.0) © 2011-2012 Yanick Castonguay");
            sb.AppendLine("BASS audio library © 1999-2012 Un4seen Developments.");
            sb.AppendLine("BASS.NET audio library © 2005-2012 radio42.");
            sb.AppendLine();
            sb.Append("Loading...");

            win = Curses.initscr(); // Start curses mode
            Curses.raw();
            win.keypad(true);
            Curses.noecho();  // Dont output chars while getch
            Curses.cbreak();  // Take input chars one at a time
            Curses.start_color();
            Curses.use_default_colors();
            Curses.init_pair(1, Curses.COLOR_WHITE, Curses.COLOR_BLUE);
            Curses.init_pair(2, Curses.COLOR_WHITE, Curses.COLOR_BLACK);
            Curses.init_pair(3, Curses.COLOR_BLACK, Curses.COLOR_WHITE);
            Curses.init_pair(4, Curses.COLOR_YELLOW, Curses.COLOR_BLUE);
            Curses.addstr(sb.ToString());
            Curses.refresh();
        }