Example #1
0
        void OutlineTreeIconFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            var    pixRenderer = (CellRendererPixbuf)cell;
            object o           = model.GetValue(iter, 0);
            string id          = null;

            if (o is DNode)
            {
                var icon = DIcons.GetNodeIcon(o as DNode);
                if (!icon.IsNull)
                {
                    id = icon.Name;
                }
            }
            else if (o is StatementContainingStatement)
            {
                id = "gtk-add";
            }

            if (id != null)
            {
                using (var img = ImageService.GetIcon(id))
                    pixRenderer.Pixbuf = img.ToPixbuf(IconSize.Menu);
            }
        }
Example #2
0
 public Xwt.Drawing.Image GetIcon(int n)
 {
     return(ImageService.GetIcon(DIcons.GetNodeIcon(Symbols[n] as DNode).Name, Gtk.IconSize.Menu));
 }
Example #3
0
        private void UpdatePath(object sender, Mono.TextEditor.DocumentLocationEventArgs e)
        {
            var SyntaxTree = Document.GetDAst();

            if (SyntaxTree == null)
            {
                return;
            }

            // Resolve the hovered piece of code
            var loc          = new CodeLocation(Document.Editor.Caret.Location.Column, Document.Editor.Caret.Location.Line);
            var currentblock = DResolver.SearchBlockAt(SyntaxTree, loc);

            //could be an enum value, which is not IBlockNode
            if (currentblock is DEnum)
            {
                foreach (INode nd in (currentblock as DEnum).Children)
                {
                    if ((nd is DEnumValue) &&
                        ((nd.Location <= loc) && (nd.EndLocation >= loc)))
                    {
                        currentblock = nd as IBlockNode;
                        break;
                    }
                }
            }

            List <PathEntry> result = new List <PathEntry>();
            INode            node   = currentblock;
            PathEntry        entry;

            while ((node != null) && ((node is IBlockNode) || (node is DEnumValue)))
            {
                var icon = DIcons.GetNodeIcon(node as DNode);

                entry          = new PathEntry(icon.IsNull?null: ImageService.GetIcon(icon.Name, IconSize.Menu), node.Name + DParameterDataProvider.GetNodeParamString(node));
                entry.Position = EntryPosition.Left;
                entry.Tag      = node;
                //do not include the module in the path bar
                if ((node.Parent != null) && !((node is DNode) && (node as DNode).IsAnonymous))
                {
                    result.Insert(0, entry);
                }
                node = node.Parent;
            }

            if (!((currentblock is DMethod) || (currentblock is DEnumValue)))
            {
                PathEntry noSelection = new PathEntry(GettextCatalog.GetString("No Selection"))
                {
                    Tag = new NoSelectionCustomNode(currentblock)
                };
                result.Add(noSelection);
            }

            entry = GetRegionEntry(Document.GetDDocument(), Document.Editor.Caret.Location);
            if (entry != null)
            {
                result.Add(entry);
            }

            var prev = CurrentPath;

            CurrentPath = result.ToArray();
            OnPathChanged(new DocumentPathChangedEventArgs(prev));
        }
Example #4
0
        Xwt.Drawing.Image DropDownBoxListWindow.IListDataProvider.GetIcon(int n)
        {
            var icon = DIcons.GetNodeIcon(memberList[n] as DNode);

            return(ImageService.GetIcon(icon.Name, IconSize.Menu));
        }
Example #5
0
    static void _Main(string[] args)
    {
        //Debug_.PrintLoadedAssemblies(true, !true);

        AppDomain.CurrentDomain.UnhandledException += _UnhandledException;
        process.ThisThreadSetComApartment_(ApartmentState.STA);
        process.thisProcessCultureIsInvariant = true;
        DebugTraceListener.Setup(usePrint: true);
        Directory.SetCurrentDirectory(folders.ThisApp);                     //it is c:\windows\system32 when restarted as admin
        Api.SetSearchPathMode(Api.BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE); //let SearchPath search in current directory after system directories
        Api.SetErrorMode(Api.GetErrorMode() | Api.SEM_FAILCRITICALERRORS);  //disable some error message boxes, eg when removable media not found; MSDN recommends too.
        _SetThisAppDocuments();

        if (CommandLine.ProgramStarted2(args))
        {
            return;
        }

        PrintServer = new print.Server(true)
        {
            NoNewline = true
        };
        PrintServer.Start();
#if TRACE
        print.qm2.use = !true;
        //timer.after(1, _ => perf.nw());
#endif

        perf.next('o');
        Settings = AppSettings.Load();         //the slowest part, >50 ms. Loads many dlls.
        //Debug_.PrintLoadedAssemblies(true, !true);
        perf.next('s');
        UserGuid = Settings.user; if (UserGuid == null)
        {
            Settings.user = UserGuid = Guid.NewGuid().ToString();
        }

        AssemblyLoadContext.Default.Resolving             += _Assembly_Resolving;
        AssemblyLoadContext.Default.ResolvingUnmanagedDll += _UnmanagedDll_Resolving;

        Tasks = new RunningTasks();
        perf.next('t');

        script.editor.IconNameToXaml_ = (s, what) => DIcons.GetIconString(s, what);
        FilesModel.LoadWorkspace(CommandLine.WorkspaceDirectory);
        perf.next('W');
        CommandLine.ProgramLoaded();
        perf.next('c');
        Loaded = EProgramState.LoadedWorkspace;

        timer.every(1000, t => _TimerProc(t));
        //note: timer can make Process Hacker/Explorer show CPU usage, even if we do nothing. Eg 0.02 if 250, 0.01 if 500, <0.01 if 1000.
        //Timer1s += () => print.it("1 s");
        //Timer1sOr025s += () => print.it("0.25 s");

        TrayIcon.Update_();
        perf.next('i');

        _app = new() {
            ShutdownMode = ShutdownMode.OnExplicitShutdown             //will set OnMainWindowClose when creating main window. If now, would exit if a startup script shows/closes a WPF window.
        };
        _app.Dispatcher.InvokeAsync(() => Model.RunStartupScripts());
        if (!Settings.runHidden || CommandLine.StartVisible)
        {
            _app.Dispatcher.Invoke(() => ShowWindow());
        }
        try {
            _app.Run();
            //Hidden app should start as fast as possible, because usually starts with Windows.
            //Tested with native message loop. Faster by 70 ms (240 vs 310 without the .NET startup time).
            //	But then problems. Eg cannot auto-create main window synchronously, because need to exit native loop and start WPF loop.
        }
        finally {
            Loaded = EProgramState.Unloading;
            var fm = Model; Model = null;
            fm.Dispose();             //stops tasks etc
            Loaded = EProgramState.Unloaded;

            PrintServer.Stop();
        }
    }
Example #6
0
File: DIcons.cs Project: qmgindi/Au
 protected override void OnClosed(EventArgs e)
 {
     s_dialog = null;
     base.OnClosed(e);
 }
Example #7
0
 public static void Icons()
 {
     DIcons.ZShow();
 }