diff --git a/TBO/ApplicationLibrary.cs b/TBO/ApplicationLibrary.cs
new file mode 100644
index 0000000..5982623
--- /dev/null
+++ b/TBO/ApplicationLibrary.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using TBO.i18n;
+using TBO.UI.tboTK;
+
+namespace TBO
+{
+ class ApplicationLibrary : Application
+ {
+ public override string Id => "Library";
+ public override string Title => I18n.Lang.Library;
+ }
+}
diff --git a/TBO/Program.cs b/TBO/Program.cs
index e1a4a4f..07ecb83 100644
--- a/TBO/Program.cs
+++ b/TBO/Program.cs
@@ -1,5 +1,6 @@
using Microsoft.Win32;
using System;
+using System.IO;
using System.Reflection;
using TBO.UI;
using XWolf;
@@ -9,16 +10,30 @@
static class Program
{
///
- /// The main entry point for the application.
+ /// The main entry point for the appl-ication.
///
[STAThread]
- static void Main()
+ static void Main(string[] args)
{
+ if (args.Length > 0)
+ {
+ if (args[0].ToLower() == "studio")
+ UIManager.Manager.EnterStudio(null);
+ else
+ if (Directory.Exists(args[0]))
+ UIManager.Manager.EnterStudio(args[0]);
+ else
+ if (File.Exists(args[0]))
+ UIManager.Manager.EnterReader(args[0]);
+ else
+ UIManager.Manager.EnterReader(null);
+ }
+ else UIManager.Manager.EnterReader(null);
//ShellNotification.NotifyOfChange();
//if (!FileAssociation.IsAssociatedWithMe("tbo"))
// FileAssociation.AssociateMe("tbo", "XWolfTebeo", "Tebeo", 0);
//AssociateMe("tbo", "XWolfTebeo", "Tebeo", 0,null);
- UIManager.Manager.EnterStudio();
+
}
}
}
diff --git a/TBO/TBO.csproj b/TBO/TBO.csproj
index 3e8159d..1533047 100644
--- a/TBO/TBO.csproj
+++ b/TBO/TBO.csproj
@@ -47,16 +47,22 @@
-
- FileAssociationNT6.cs
-
xIO2.cs
+
+
+
+
+
+
+
+
+
Form
@@ -77,6 +83,7 @@
Studio.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
@@ -114,6 +121,11 @@
+
+
+
+
+
diff --git a/TBO/UI/Shell.cs b/TBO/UI/Shell.cs
new file mode 100644
index 0000000..aba0cb6
--- /dev/null
+++ b/TBO/UI/Shell.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using TBO.UI.tboTK;
+
+namespace TBO.UI
+{
+ static class Shell
+ {
+ private static Color bgColor = Color.FromArgb(255, 195, 0);
+ private static Image bgImage = Properties.Resources.comicbg;
+ private static Dictionary applications = new Dictionary();
+ private static Application current;
+
+ static Shell()
+ {
+ AddApp(new ApplicationLibrary());
+ }
+
+ private static void AddApp(Application app)
+ {
+ applications[app.Id] = app;
+ }
+
+ public static void GoTo(string id)
+ {
+ Application app;
+ if (applications.TryGetValue(id,out app))
+ {
+ current = app;
+
+ }
+ }
+
+ public static void Paint(Graphics g, Rectangle clip, Size size)
+ {
+
+ }
+ }
+}
diff --git a/TBO/UI/UIManager.cs b/TBO/UI/UIManager.cs
index a7924bf..4594156 100644
--- a/TBO/UI/UIManager.cs
+++ b/TBO/UI/UIManager.cs
@@ -21,8 +21,8 @@
manager = new UIManagerWindows();
}
- public abstract void EnterReader();
- public abstract void EnterStudio();
+ public abstract void EnterReader(string path);
+ public abstract void EnterStudio(string path);
public abstract void ShowAbout();
public static UIManager Manager => manager;
diff --git a/TBO/UI/Windows/Reader.Designer.cs b/TBO/UI/Windows/Reader.Designer.cs
index d308d44..7a591d4 100644
--- a/TBO/UI/Windows/Reader.Designer.cs
+++ b/TBO/UI/Windows/Reader.Designer.cs
@@ -33,13 +33,18 @@
//
// Reader
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
+ this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
+ this.ClientSize = new System.Drawing.Size(1200, 692);
+ this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+ this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "Reader";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "TBO";
+ this.Paint += new System.Windows.Forms.PaintEventHandler(this.Reader_Paint);
+ this.Resize += new System.EventHandler(this.Reader_Resize);
this.ResumeLayout(false);
}
diff --git a/TBO/UI/Windows/Reader.cs b/TBO/UI/Windows/Reader.cs
index 36c9f96..349b45c 100644
--- a/TBO/UI/Windows/Reader.cs
+++ b/TBO/UI/Windows/Reader.cs
@@ -3,6 +3,7 @@
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
@@ -11,9 +12,81 @@
{
public partial class Reader : Form
{
- public Reader()
+ //private TBOFile tbo;
+ private bool inFS = true;
+ //private bool inLibrary=true;
+
+
+ public Reader(string path)
{
InitializeComponent();
+ SwapFullScreen();
+ if (path != null)
+ LoadTBO(path);
+ }
+
+ private void LoadTBO(string path)
+ {
+ //try
+ //{
+ // tbo = new TBOFile(path);
+ // if (string.IsNullOrEmpty(tbo.Title))
+ // Text = "TBO [" + Path.GetFileNameWithoutExtension(path) + "]";
+ // else
+ // {
+ // string title = tbo.Title;
+ // if (!string.IsNullOrEmpty(tbo.Variant))
+ // title += " [" + tbo.Variant + "]";
+ // if (!string.IsNullOrEmpty(tbo.Volume))
+ // title += " vol." + tbo.Volume;
+ // Text = title;
+ // }
+ // inLibrary = false;
+ //}
+ //catch (Exception ex)
+ //{
+ // MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ //}
+ }
+
+ private void SwapFullScreen()
+ {
+ inFS = !inFS;
+ if (inFS)
+ {
+ SuspendLayout();
+ FormBorderStyle = FormBorderStyle.None;
+ Rectangle scr = Screen.FromControl(this).Bounds;
+ Location = scr.Location;
+ ClientSize = scr.Size;
+ ResumeLayout();
+ }
+ else
+ {
+ SuspendLayout();
+ FormBorderStyle = FormBorderStyle.Sizable;
+ Rectangle scr = Screen.FromControl(this).WorkingArea;
+ int w = scr.Width * 2 / 3;
+ Location = new Point(scr.Left + ((scr.Width - w) / 2), scr.Top);
+ Size = new Size(w, scr.Height);
+ ResumeLayout();
+ }
+ }
+
+ private void pbFullScreen_Click(object sender, EventArgs e)
+ {
+ SwapFullScreen();
+ }
+
+ private void Reader_Paint(object sender, PaintEventArgs e)
+ {
+ e.Graphics.SetClip(e.ClipRectangle);
+ Shell.Paint(e.Graphics, e.ClipRectangle, ClientSize);
+ }
+
+ private void Reader_Resize(object sender, EventArgs e)
+ {
+ Invalidate();
}
}
}
diff --git a/TBO/UI/Windows/Studio.cs b/TBO/UI/Windows/Studio.cs
index 5eef6cf..eb448e5 100644
--- a/TBO/UI/Windows/Studio.cs
+++ b/TBO/UI/Windows/Studio.cs
@@ -9,9 +9,14 @@
public partial class Studio : Form
{
- public Studio()
+ public Studio(string path)
{
InitializeComponent();
+ if (path != null)
+ {
+ tbInputDir.Text = path;
+ tbTBO.Text = GetDefaultTBOName();
+ }
}
private string FBytes(double bytes)
@@ -45,6 +50,11 @@
return bytes.ToString("0.00") + tail;
}
+ private string GetDefaultTBOName()
+ {
+ return Path.Combine(Path.GetDirectoryName(tbInputDir.Text), Path.GetFileNameWithoutExtension(tbInputDir.Text)) + ".tebeo";
+ }
+
private void btInputDir_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
@@ -56,7 +66,7 @@
if (fbd.ShowDialog() == DialogResult.OK)
{
tbInputDir.Text = fbd.SelectedPath;
- tbTBO.Text = Path.Combine(Path.GetDirectoryName(fbd.SelectedPath), Path.GetFileNameWithoutExtension(fbd.SelectedPath)) + ".tebeo.png";
+ tbTBO.Text = GetDefaultTBOName();
}
}
@@ -129,10 +139,10 @@
}
}
}
- //catch (Exception ex)
- //{
- // MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- //}
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
finally
{
btGo.Enabled = true;
diff --git a/TBO/UI/Windows/UIManagerWindows.cs b/TBO/UI/Windows/UIManagerWindows.cs
index b0f39a9..b7c3e8d 100644
--- a/TBO/UI/Windows/UIManagerWindows.cs
+++ b/TBO/UI/Windows/UIManagerWindows.cs
@@ -1,4 +1,5 @@
using System.Windows.Forms;
+using XWolf;
namespace TBO.UI.Windows
{
@@ -7,18 +8,23 @@
public UIManagerWindows()
{
+ try
+ {
+ WinAPI.SetProcessDPIAware();
+ }
+ catch { };
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
}
- public override void EnterReader()
+ public override void EnterReader(string path)
{
- Application.Run(new Reader());
+ Application.Run(new Reader(path));
}
- public override void EnterStudio()
+ public override void EnterStudio(string path)
{
- Application.Run(new Studio());
+ Application.Run(new Studio(path));
}
public override void ShowAbout()
diff --git a/TBO/UI/Windows/WinAPI.cs b/TBO/UI/Windows/WinAPI.cs
new file mode 100644
index 0000000..6577370
--- /dev/null
+++ b/TBO/UI/Windows/WinAPI.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace XWolf
+{
+ static partial class WinAPI
+ {
+ [DllImport("user32.dll", SetLastError = true)]
+ public static extern bool SetProcessDPIAware();
+ }
+}
diff --git a/TBO/UI/tboTK/Application.cs b/TBO/UI/tboTK/Application.cs
new file mode 100644
index 0000000..ba65b1a
--- /dev/null
+++ b/TBO/UI/tboTK/Application.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace TBO.UI.tboTK
+{
+ abstract class Application
+ {
+ public abstract string Id { get; }
+ public abstract string Title { get; }
+ }
+}
diff --git a/TBO/UI/tboTK/Button.cs b/TBO/UI/tboTK/Button.cs
new file mode 100644
index 0000000..4170985
--- /dev/null
+++ b/TBO/UI/tboTK/Button.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace TBO.UI.tboTK
+{
+ class Button:Control
+ {
+ }
+}
diff --git a/TBO/UI/tboTK/Control.cs b/TBO/UI/tboTK/Control.cs
new file mode 100644
index 0000000..8eb2d79
--- /dev/null
+++ b/TBO/UI/tboTK/Control.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace TBO.UI.tboTK
+{
+ class Control
+ {
+ public string Id;
+ }
+}
diff --git a/TBO/UI/tboTK/Renderer.cs b/TBO/UI/tboTK/Renderer.cs
new file mode 100644
index 0000000..2eed2aa
--- /dev/null
+++ b/TBO/UI/tboTK/Renderer.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace TBO.UI.tboTK
+{
+ class Renderer
+ {
+ }
+}
diff --git a/TBO/i18n/English.cs b/TBO/i18n/English.cs
new file mode 100644
index 0000000..9b1c3be
--- /dev/null
+++ b/TBO/i18n/English.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace TBO.i18n
+{
+ class English : I18n
+ {
+ public override string Library => "Library";
+ }
+}
diff --git a/TBO/i18n/Spanish.cs b/TBO/i18n/Spanish.cs
new file mode 100644
index 0000000..55472ca
--- /dev/null
+++ b/TBO/i18n/Spanish.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace TBO.i18n
+{
+ class Spanish : I18n
+ {
+ public override string Library => "Biblioteca";
+ }
+}
diff --git a/TBO/i18n/i18n.cs b/TBO/i18n/i18n.cs
new file mode 100644
index 0000000..3f008b7
--- /dev/null
+++ b/TBO/i18n/i18n.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+
+namespace TBO.i18n
+{
+ abstract class I18n
+ {
+ static private I18n i18n;
+
+ static I18n()
+ {
+ CultureInfo ci = CultureInfo.CurrentCulture;
+ switch (ci.Parent.Name)
+ {
+ case "es":
+ i18n = new Spanish();
+ break;
+ default:
+ i18n = new English();
+ break;
+ }
+ }
+
+ public static I18n Lang => i18n;
+ public abstract string Library { get; }
+ }
+}