Example #1
0
        public ChatView(ChatModel chat, MainWindow window)
        {
            Trace.Call(chat, window);

            if (chat == null) {
                throw new ArgumentNullException("chat");
            }
            if (window == null) {
                throw new ArgumentNullException("window");
            }

            ChatModel = chat;
            f_MainWindow = window;
            f_WidgetID = f_NextID++;
            f_WidgetName = "output_textview_" + f_WidgetID;

            f_MainWindow.Modify("output_vbox", "append",
                "{" +
                    "textview[" + f_WidgetName + "] " +
                        ".expand:vh " +
                        ".display[" + f_WidgetID + "d]:0 " +
                        "offset[" + f_WidgetID + "os]:0 " +
                        "richtext:1 " +
                        "style_color0_normal:fg=black " +
                        "style_color1_normal:fg=red " +
                        "style_color2_normal:fg=green " +
                        "style_color3_normal:fg=yellow " +
                        "style_color4_normal:fg=blue " +
                        "style_color5_normal:fg=magenta " +
                        "style_color6_normal:fg=cyan " +
                        "style_color7_normal:fg=white " +
                        "style_color8_normal:fg=black,attr=bold " +
                        "style_color9_normal:fg=red,attr=bold " +
                        "style_color10_normal:fg=green,attr=bold " +
                        "style_color11_normal:fg=yellow,attr=bold " +
                        "style_color12_normal:fg=blue,attr=bold " +
                        "style_color13_normal:fg=magenta,attr=bold " +
                        "style_color14_normal:fg=cyan,attr=bold " +
                        "style_color15_normal:fg=white,attr=bold " +
                        "style_url_normal:attr=underline " +
                        "style_u_normal:attr=underline " +
                        "style_b_normal:attr=bold " +
                        "style_i_normal:attr=standout " +
                "}"
            );
            MessageTextView = new TextView(f_MainWindow, f_WidgetName);
            MessageTextView.OffsetVariableName = f_WidgetID + "os";
            // HACK: as the chat is not always visible we can't extract the
            // heigth and width information from the textview because it simply
            // returns 0 when invisible, thus we need to abuse output_vbox
            MessageTextView.HeigthVariableName = "output_vbox:h";
            MessageTextView.WidthVariableName = "output_vbox:w";
            MessageTextView.AutoLineWrap = true;

            Participants = new List<PersonModel>();
        }
Example #2
0
File: Entry.cs Project: vith/smuxi
        public Entry(MainWindow mainWindow, ChatViewManager chatViewManager)
        {
            if (mainWindow == null) {
                throw new ArgumentNullException("mainWindow");
               }
               if (chatViewManager == null) {
                throw new ArgumentNullException("chatViewManager");
               }

            f_MainWindow = mainWindow;
            f_MainWindow.KeyPressed += OnKeyPressed;

            f_ChatViewManager = chatViewManager;
            f_ChatViewManager.CurrentChatSwitched += OnChatSwitched;
        }
Example #3
0
        public Entry(MainWindow mainWindow, ChatViewManager chatViewManager)
        {
            if (mainWindow == null) {
                throw new ArgumentNullException("mainWindow");
            }
            if (chatViewManager == null) {
                throw new ArgumentNullException("chatViewManager");
            }

            f_MainWindow = mainWindow;
            f_MainWindow.KeyPressed += OnKeyPressed;

            f_ChatViewManager = chatViewManager;

            Frontend.SessionPropertyChanged += delegate {
                InitCommandManager();
            };

            Settings = new EntrySettings();
            NickCompleter = new TabCycleNickCompleter();
        }
Example #4
0
        public ChatView(ChatModel chat, MainWindow window)
        {
            Trace.Call(chat, window);

            if (chat == null) {
                throw new ArgumentNullException("chat");
            }
            if (window == null) {
                throw new ArgumentNullException("window");
            }

            f_ChatModel = chat;
            f_MainWindow = window;
            f_WidgetID = f_NextID++;
            f_WidgetName = "output_textview_" + f_WidgetID;

            f_MainWindow.Modify("output_vbox", "append",
                "{" +
                    "textview[" + f_WidgetName + "] " +
                        ".expand:vh " +
                        ".display[" + f_WidgetID + "d]:0 " +
                        "offset[" + f_WidgetID + "os]:0 " +
                        "richtext:1 " +
                        "style_red_normal:fg=red " +
                        "style_url_normal:attr=underline " +
                        "style_u_normal:attr=underline " +
                        "style_b_normal:attr=bold " +
                        "style_i_normal:attr=standout " +
                "}"
            );
            MessageTextView = new TextView(f_MainWindow, f_WidgetName);
            MessageTextView.OffsetVariableName = f_WidgetID + "os";
            // HACK: as the chat is not always visible we can't extract the
            // heigth and width information from the textview because it simply
            // returns 0 when invisible, thus we need to abuse output_vbox
            MessageTextView.HeigthVariableName = "output_vbox:h";
            MessageTextView.WidthVariableName = "output_vbox:w";
            MessageTextView.AutoLineWrap = true;
        }
Example #5
0
        public static void Init(string[] args)
        {
            System.Threading.Thread.CurrentThread.Name = "Main";
            Trace.Call(args);

            Assembly asm = Assembly.GetAssembly(typeof(Frontend));
            AssemblyName asm_name = asm.GetName(false);
            AssemblyProductAttribute pr = (AssemblyProductAttribute)asm.
                GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];
            _Version = asm_name.Version;
            _VersionNumber = asm_name.Version.ToString();
            _VersionString = pr.Product + " - " + _UIName + " frontend " + _Version;

            //STFL.error_action("print");

            #if LOG4NET
            _Logger.Info(_VersionString + " starting");
            #endif
            _MainWindow = new MainWindow();

            _FrontendConfig = new FrontendConfig(UIName);
            // loading and setting defaults
            _FrontendConfig.Load();
            _FrontendConfig.Save();

            if (_FrontendConfig.IsCleanConfig) {
                // first start assistant
            } else {
                if (((string)FrontendConfig["Engines/Default"]).Length == 0) {
                    InitLocalEngine();
                } else {
                    // there is a default engine set, means we want a remote engine
                    //new EngineManagerDialog();
                    InitLocalEngine();
                }
            }

            while (true) {
                // wait maximum for 500ms, to force a refresh even when
                // not hitting a key
                _MainWindow.Run(500);
            }
            #if LOG4NET
               _Logger.Warn("_MainWindow.Run() returned!");
            #endif
        }
Example #6
0
 public ChatViewManager(MainWindow mainWindow)
 {
     _MainWindow = mainWindow;
 }
Example #7
0
        public static void Init(string engine)
        {
            System.Threading.Thread.CurrentThread.Name = "Main";
            Trace.Call(engine);

            Assembly asm = Assembly.GetAssembly(typeof(Frontend));
            AssemblyName asm_name = asm.GetName(false);
            AssemblyProductAttribute pr = (AssemblyProductAttribute)asm.
                GetCustomAttributes(typeof(AssemblyProductAttribute), false)[0];
            _Version = asm_name.Version;
            _VersionNumber = asm_name.Version.ToString();
            _VersionString = pr.Product + " - " + _UIName + " frontend " + _Version;

            // this always calls abort() :(((
            //StflApi.stfl_error_action("print");

            #if LOG4NET
            _Logger.Info(_VersionString + " starting");
            #endif
            _MainWindow = new MainWindow();

            _FrontendConfig = new FrontendConfig(UIName);
            // loading and setting defaults
            _FrontendConfig.Load();
            _FrontendConfig.Save();

            if (_FrontendConfig.IsCleanConfig) {
                // first start assistant
            } else {
                if (String.IsNullOrEmpty(engine) || engine == "local") {
                    InitLocalEngine();
                } else {
                    InitRemoteEngine(engine);
                }
            }

            while (true) {
                // wait maximum for 500ms, to force a refresh even when
                // not hitting a key
                _MainWindow.Run(500);
            }
            #if LOG4NET
               _Logger.Warn("_MainWindow.Run() returned!");
            #endif
        }
Example #8
0
        public ChatViewManager(MainWindow mainWindow)
        {
            if (mainWindow == null) {
                throw new ArgumentNullException("mainWindow");
               }

               f_MainWindow = mainWindow;
        }
Example #9
0
 public Entry(MainWindow mainWindow)
 {
     _MainWindow = mainWindow;
     _MainWindow.KeyPressed += new KeyPressedEventHandler(_OnKeyPressed);
 }
Example #10
0
 public GroupChatView(ChatModel chat, MainWindow window)
     : base(chat, window)
 {
     Trace.Call(chat, window);
 }