Skip to content

Commit

Permalink
Split project into library, console and UI. Done with basic UI
Browse files Browse the repository at this point in the history
  • Loading branch information
vchekan committed Oct 22, 2009
1 parent 7bf452b commit 86f50a3
Show file tree
Hide file tree
Showing 15 changed files with 417 additions and 44 deletions.
43 changes: 43 additions & 0 deletions CodeQL.Console/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// Copyright (C) 2009 Vadim Chekan
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("CodeQL.Console")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
26 changes: 26 additions & 0 deletions CodeQL.Console/CodeQL.Console.mdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project name="CodeQL.Console" fileversion="2.0" language="C#" targetFramework="3.5" ctype="DotNetProject">
<Configurations active="Debug">
<Configuration name="Debug" ctype="DotNetProjectConfiguration">
<Output directory="bin/Debug" assembly="CodeQL.Console" />
<Build debugmode="True" target="Exe" />
<Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
<CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
</Configuration>
<Configuration name="Release" ctype="DotNetProjectConfiguration">
<Output directory="bin/Release" assembly="CodeQL.Console" />
<Build debugmode="False" target="Exe" />
<Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
<CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
</Configuration>
</Configurations>
<Contents>
<File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
<File name="Main.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<ProjectReference type="Project" localcopy="True" refto="CodeQL" />
<ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../lib/Mono.Cecil.dll" />
<ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../lib/NDesk.Options.dll" />
</References>
</Project>
31 changes: 16 additions & 15 deletions Main.cs → CodeQL.Console/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
using System.Collections.Generic;
using System.IO;
using Mono.Cecil;
using System.Data;
using CodeQL;
using SysConsole=System.Console;

namespace CodeQL
namespace CodeQL.Console
{
class MainClass
{
Expand All @@ -41,28 +42,28 @@ public static int Main(string[] args)
Parse(args);

if(_action == null) {
Console.Error.WriteLine("No action defined");
SysConsole.Error.WriteLine("No action defined");
return 1;
}

_action();

Console.WriteLine("Done");
SysConsole.WriteLine("Done");
return 0;
}

static void Print() {
_walker.Walk((file,asm) => Console.WriteLine("{0}:{1}", file, asm.Name.Name),
type => Console.WriteLine(" {0}",type.Name),
att => Console.WriteLine(" {0}", att),
ctor => Console.WriteLine(" .ctor:{0}", ctor),
evt => Console.WriteLine(" event:{0}",evt),
field => Console.WriteLine(" field:{0}", field),
generic => Console.WriteLine(" generic:{0}",generic),
iface => Console.WriteLine(" interface:{0}",iface),
method => Console.WriteLine(" method:{0}()", method),
nestedType => Console.WriteLine(" nested type:{0}", nestedType),
prop => Console.WriteLine(" prop:{0}",prop)
_walker.Walk((file,asm) => SysConsole.WriteLine("{0}:{1}", file, asm.Name.Name),
type => SysConsole.WriteLine(" {0}",type.Name),
att => SysConsole.WriteLine(" {0}", att),
ctor => SysConsole.WriteLine(" .ctor:{0}", ctor),
evt => SysConsole.WriteLine(" event:{0}",evt),
field => SysConsole.WriteLine(" field:{0}", field),
generic => SysConsole.WriteLine(" generic:{0}",generic),
iface => SysConsole.WriteLine(" interface:{0}",iface),
method => SysConsole.WriteLine(" method:{0}()", method),
nestedType => SysConsole.WriteLine(" nested type:{0}", nestedType),
prop => SysConsole.WriteLine(" prop:{0}",prop)
);
}

Expand Down
7 changes: 6 additions & 1 deletion CodeQL.UI/CodeQL.UI.mdp
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project name="CodeQL.UI" fileversion="2.0" language="C#" targetFramework="2.0" ctype="DotNetProject">
<Project name="CodeQL.UI" fileversion="2.0" language="C#" targetFramework="3.5" ctype="DotNetProject">
<Configurations active="Debug">
<Configuration name="Debug" ctype="DotNetProjectConfiguration">
<Output directory="bin/Debug" assembly="CodeQL.UI" />
<Build debugmode="True" target="Exe" />
<Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
<EnvironmentVariables />
<CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
</Configuration>
<Configuration name="Release" ctype="DotNetProjectConfiguration">
Expand All @@ -20,6 +21,8 @@
<File name="gtk-gui/MainWindow.cs" subtype="Code" buildaction="Compile" />
<File name="Main.cs" subtype="Code" buildaction="Compile" />
<File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
<File name="ProjectProperties.cs" subtype="Code" buildaction="Compile" />
<File name="gtk-gui/CodeQL.UI.ProjectProperties.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Expand All @@ -29,5 +32,7 @@
<ProjectReference type="Gac" localcopy="True" specificVersion="False" refto="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<ProjectReference type="Gac" localcopy="True" specificVersion="False" refto="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<ProjectReference type="Project" localcopy="True" refto="CodeQL" />
</References>
</Project>
40 changes: 34 additions & 6 deletions CodeQL.UI/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,29 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
using System;
using System.Linq;
using Gtk;

using CodeQL;

public partial class MainWindow: Gtk.Window
{
const string STATUS_BAR_CTS = "StatusBarContext";
uint _statusCtx;
static Db _db = new Db();

public MainWindow (): base (Gtk.WindowType.Toplevel)
{
Build ();

uint ctx = statusbar1.GetContextId(STATUS_BAR_CTS);
statusbar1.Push(ctx, "Ready");
_statusCtx = this.statusbar.GetContextId(STATUS_BAR_CTS);
this.statusbar.Push(_statusCtx, "Ready");

GLib.ExceptionManager.UnhandledException += delegate(GLib.UnhandledExceptionArgs args) {
statusbar.Push(_statusCtx, "Error: "+((Exception)args.ExceptionObject).Message);
};


}

protected void OnDeleteEvent (object sender, DeleteEventArgs a)
Expand All @@ -43,13 +54,30 @@ protected virtual void OnExitActionActivated (object sender, System.EventArgs e)

protected virtual void OnLoadActionActivated (object sender, System.EventArgs e)
{
uint loadingCtx = statusbar1.GetContextId(STATUS_BAR_CTS);
statusbar1.Push(loadingCtx, "Loading...");
statusbar.Push(_statusCtx, "Loading...");

//var item = (MenuItem)this.LastProjectsAction.CreateMenuItem();
var menu = (Menu)((ImageMenuItem)this.UIManager.GetWidget("/menubar2/FileAction/LastProjectsAction")).Submenu;

foreach(var widget in menu.Children)
menu.Remove(widget);

foreach(var proj in _db.ProjectsLoad()) {
var item = new MenuItem(proj.Title);
menu.Append(item);
}
menu.ShowAll();


System.Threading.ThreadPool.QueueUserWorkItem((o) => {
System.Threading.Thread.Sleep(5000);
Application.Invoke((obj,ars) => {
statusbar1.Pop(loadingCtx);
statusbar.Pop(_statusCtx);
});
});
}

protected virtual void OnLastProjectsActionActivated (object sender, System.EventArgs e)
{

}
}
33 changes: 33 additions & 0 deletions CodeQL.UI/ProjectProperties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// Copyright (C) 2009 Vadim Chekan
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//

using System;

namespace CodeQL.UI
{


public partial class ProjectProperties : Gtk.Dialog
{

public ProjectProperties()
{
this.Build();
}
}
}
78 changes: 78 additions & 0 deletions CodeQL.UI/gtk-gui/CodeQL.UI.ProjectProperties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
//
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------

namespace CodeQL.UI {


public partial class ProjectProperties {

private Gtk.VBox vbox2;

private Gtk.Button buttonCancel;

private Gtk.Button buttonOk;

protected virtual void Build() {
Stetic.Gui.Initialize(this);
// Widget CodeQL.UI.ProjectProperties
this.Name = "CodeQL.UI.ProjectProperties";
this.WindowPosition = ((Gtk.WindowPosition)(4));
this.HasSeparator = false;
// Internal child CodeQL.UI.ProjectProperties.VBox
Gtk.VBox w1 = this.VBox;
w1.Name = "dialog1_VBox";
w1.BorderWidth = ((uint)(2));
// Container child dialog1_VBox.Gtk.Box+BoxChild
this.vbox2 = new Gtk.VBox();
this.vbox2.Name = "vbox2";
this.vbox2.Spacing = 6;
w1.Add(this.vbox2);
Gtk.Box.BoxChild w2 = ((Gtk.Box.BoxChild)(w1[this.vbox2]));
w2.Position = 0;
// Internal child CodeQL.UI.ProjectProperties.ActionArea
Gtk.HButtonBox w3 = this.ActionArea;
w3.Name = "dialog1_ActionArea";
w3.Spacing = 6;
w3.BorderWidth = ((uint)(5));
w3.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonCancel = new Gtk.Button();
this.buttonCancel.CanDefault = true;
this.buttonCancel.CanFocus = true;
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.UseStock = true;
this.buttonCancel.UseUnderline = true;
this.buttonCancel.Label = "gtk-cancel";
this.AddActionWidget(this.buttonCancel, -6);
Gtk.ButtonBox.ButtonBoxChild w4 = ((Gtk.ButtonBox.ButtonBoxChild)(w3[this.buttonCancel]));
w4.Expand = false;
w4.Fill = false;
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonOk = new Gtk.Button();
this.buttonOk.CanDefault = true;
this.buttonOk.CanFocus = true;
this.buttonOk.Name = "buttonOk";
this.buttonOk.UseStock = true;
this.buttonOk.UseUnderline = true;
this.buttonOk.Label = "gtk-ok";
this.AddActionWidget(this.buttonOk, -5);
Gtk.ButtonBox.ButtonBoxChild w5 = ((Gtk.ButtonBox.ButtonBoxChild)(w3[this.buttonOk]));
w5.Position = 1;
w5.Expand = false;
w5.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll();
}
this.DefaultWidth = 400;
this.DefaultHeight = 441;
this.Show();
}
}
}
Loading

0 comments on commit 86f50a3

Please sign in to comment.