Merge pull request #22 from pcnerd97/master

Dock and WebBrowser Improvements!
This commit is contained in:
TheUltimateHacker 2015-04-07 15:52:15 -04:00
commit be191bca81
8 changed files with 226 additions and 378 deletions

View file

@ -1,5 +1,4 @@
Imports Skybound.Gecko Imports System.IO
Imports System.IO
Namespace My Namespace My
' The following events are available for MyApplication: ' The following events are available for MyApplication:
@ -12,18 +11,6 @@ Namespace My
Partial Friend Class MyApplication Partial Friend Class MyApplication
Protected Overrides Function OnStartup(ByVal eventArgs As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) As Boolean Protected Overrides Function OnStartup(ByVal eventArgs As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) As Boolean
Dim ProfileDirectory As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\ShiftOS\xulrunner\DefaultProfile"
If Not Directory.Exists(ProfileDirectory) Then
Directory.CreateDirectory(ProfileDirectory)
End If
Xpcom.ProfileDirectory = ProfileDirectory
Dim xrPath As String = System.Reflection.Assembly.GetExecutingAssembly.Location
xrPath = xrPath.Substring(0, xrPath.LastIndexOf("\") + 1) & "\xulrunner"
Xpcom.Initialize(xrPath)
Return True Return True
End Function End Function
End Class End Class

View file

@ -33,6 +33,7 @@
My.Computer.FileSystem.CreateDirectory(Application.StartupPath + "\SoftwareData\ShiftDock") My.Computer.FileSystem.CreateDirectory(Application.StartupPath + "\SoftwareData\ShiftDock")
End If End If
System.IO.File.Create(filepath).Dispose() System.IO.File.Create(filepath).Dispose()
DockWindow.firststart = True
End If End If
End If End If

View file

@ -563,6 +563,7 @@
End Sub End Sub
Private Sub lblShiftNet_Click(sender As Object, e As EventArgs) Handles lblShiftNet.Click Private Sub lblShiftNet_Click(sender As Object, e As EventArgs) Handles lblShiftNet.Click
pnlPrograms.Hide()
totile = lblShiftNet.Text totile = lblShiftNet.Text
End Sub End Sub

View file

@ -7,6 +7,7 @@
Dim currenttile As String = 0 Dim currenttile As String = 0
Public loadevents As New DockEngine Public loadevents As New DockEngine
Public docktopbot As String = "Bottom" Public docktopbot As String = "Bottom"
Public firststart As Boolean
Public Sub colours() Public Sub colours()
'Dim img As New Bitmap(picBackColor.Width, picBackColor.Height) 'Dim img As New Bitmap(picBackColor.Width, picBackColor.Height)
@ -46,6 +47,10 @@
loadevents.writeConfFile(Me.Top, docktopbot) loadevents.writeConfFile(Me.Top, docktopbot)
Me.Top = loadevents.docktop Me.Top = loadevents.docktop
docktopbot = loadevents.topbottom docktopbot = loadevents.topbottom
If firststart = True Then
docktopbot = "Bottom"
Me.Top = screenHeight - Me.Height + 25
End If
If docktopbot = "Bottom" Then If docktopbot = "Bottom" Then
'Me.Top = screenHeight - Me.Height - 42 'Me.Top = screenHeight - Me.Height - 42
Me.picBoarder.Top = 96 Me.picBoarder.Top = 96

40
ShiftOS/ShiftOSTabs.vb Normal file
View file

@ -0,0 +1,40 @@
Public Class ShiftOSTabs
Inherits TabControl
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
DoubleBuffered = True
SizeMode = TabSizeMode.Fixed
ItemSize = New Size(120, 30)
End Sub
Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
Dim B As New Bitmap(Width, Height)
Dim G As Graphics = Graphics.FromImage(B)
G.Clear(Color.Gainsboro)
For i = 0 To TabCount - 1
Dim TabRectangle As Rectangle = GetTabRect(i)
If i = SelectedIndex Then
G.FillRectangle(Brushes.DarkGray, TabRectangle)
Else
G.FillRectangle(Brushes.LightGray, TabRectangle)
End If
G.DrawString(TabPages(i).Text, Font, Brushes.White, TabRectangle, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Next
e.Graphics.DrawImage(B.Clone, 0, 0)
G.Dispose() : B.Dispose()
MyBase.OnPaint(e)
End Sub
End Class

View file

@ -38,6 +38,7 @@ Partial Class Web_Browser
Me.pgbottomlcorner = New System.Windows.Forms.Panel() Me.pgbottomlcorner = New System.Windows.Forms.Panel()
Me.pgcontents = New System.Windows.Forms.Panel() Me.pgcontents = New System.Windows.Forms.Panel()
Me.pnlwebtabholder = New System.Windows.Forms.Panel() Me.pnlwebtabholder = New System.Windows.Forms.Panel()
Me.tabs = New TabControl 'ShiftOS.ShiftOSTabs()
Me.Panel1 = New System.Windows.Forms.Panel() Me.Panel1 = New System.Windows.Forms.Panel()
Me.btnhome = New System.Windows.Forms.Button() Me.btnhome = New System.Windows.Forms.Button()
Me.txtlocation = New System.Windows.Forms.TextBox() Me.txtlocation = New System.Windows.Forms.TextBox()
@ -45,31 +46,21 @@ Partial Class Web_Browser
Me.btnback = New System.Windows.Forms.Button() Me.btnback = New System.Windows.Forms.Button()
Me.Panel2 = New System.Windows.Forms.Panel() Me.Panel2 = New System.Windows.Forms.Panel()
Me.pnloptions = New System.Windows.Forms.Panel() Me.pnloptions = New System.Windows.Forms.Panel()
Me.btnRemTab = New System.Windows.Forms.Button()
Me.btnAddTab = New System.Windows.Forms.Button()
Me.siteloadprogress = New ShiftOS.ProgressBarEX() Me.siteloadprogress = New ShiftOS.ProgressBarEX()
Me.pnltab4 = New System.Windows.Forms.Panel()
Me.lbltab4 = New System.Windows.Forms.Label()
Me.pnltab3 = New System.Windows.Forms.Panel()
Me.lbltab3 = New System.Windows.Forms.Label()
Me.pnltab2 = New System.Windows.Forms.Panel()
Me.lbltab2 = New System.Windows.Forms.Label()
Me.pnltab1 = New System.Windows.Forms.Panel()
Me.lbltab1 = New System.Windows.Forms.Label()
Me.pgleft = New System.Windows.Forms.Panel() Me.pgleft = New System.Windows.Forms.Panel()
Me.titlebar = New System.Windows.Forms.Panel() Me.titlebar = New System.Windows.Forms.Panel()
Me.pnlicon = New System.Windows.Forms.PictureBox() Me.pnlicon = New System.Windows.Forms.PictureBox()
Me.webwindowt1 = New Skybound.Gecko.GeckoWebBrowser() Me.TabText = New System.Windows.Forms.Timer(Me.components)
Me.webwindowt2 = New Skybound.Gecko.GeckoWebBrowser() Me.UrlText = New System.Windows.Forms.Timer(Me.components)
Me.webwindowt3 = New Skybound.Gecko.GeckoWebBrowser() Me.Progress = New System.Windows.Forms.Timer(Me.components)
Me.webwindowt4 = New Skybound.Gecko.GeckoWebBrowser() Me.BrowserProgress = New ShiftOS.ProgressBarEX()
Me.pgright.SuspendLayout() Me.pgright.SuspendLayout()
Me.pgcontents.SuspendLayout() Me.pgcontents.SuspendLayout()
Me.pnlwebtabholder.SuspendLayout() Me.pnlwebtabholder.SuspendLayout()
Me.Panel1.SuspendLayout() Me.Panel1.SuspendLayout()
Me.pnloptions.SuspendLayout() Me.pnloptions.SuspendLayout()
Me.pnltab4.SuspendLayout()
Me.pnltab3.SuspendLayout()
Me.pnltab2.SuspendLayout()
Me.pnltab1.SuspendLayout()
Me.pgleft.SuspendLayout() Me.pgleft.SuspendLayout()
Me.titlebar.SuspendLayout() Me.titlebar.SuspendLayout()
CType(Me.pnlicon, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.pnlicon, System.ComponentModel.ISupportInitialize).BeginInit()
@ -191,16 +182,24 @@ Partial Class Web_Browser
' '
'pnlwebtabholder 'pnlwebtabholder
' '
Me.pnlwebtabholder.Controls.Add(Me.webwindowt4) Me.pnlwebtabholder.Controls.Add(Me.tabs)
Me.pnlwebtabholder.Controls.Add(Me.webwindowt3)
Me.pnlwebtabholder.Controls.Add(Me.webwindowt2)
Me.pnlwebtabholder.Controls.Add(Me.webwindowt1)
Me.pnlwebtabholder.Dock = System.Windows.Forms.DockStyle.Fill Me.pnlwebtabholder.Dock = System.Windows.Forms.DockStyle.Fill
Me.pnlwebtabholder.Location = New System.Drawing.Point(0, 36) Me.pnlwebtabholder.Location = New System.Drawing.Point(0, 36)
Me.pnlwebtabholder.Name = "pnlwebtabholder" Me.pnlwebtabholder.Name = "pnlwebtabholder"
Me.pnlwebtabholder.Size = New System.Drawing.Size(1054, 487) Me.pnlwebtabholder.Size = New System.Drawing.Size(1054, 487)
Me.pnlwebtabholder.TabIndex = 6 Me.pnlwebtabholder.TabIndex = 6
' '
'tabs
'
Me.tabs.Dock = System.Windows.Forms.DockStyle.Fill
Me.tabs.ItemSize = New System.Drawing.Size(120, 30)
Me.tabs.Location = New System.Drawing.Point(0, 0)
Me.tabs.Name = "tabs"
Me.tabs.SelectedIndex = 0
Me.tabs.Size = New System.Drawing.Size(1054, 487)
Me.tabs.SizeMode = System.Windows.Forms.TabSizeMode.Fixed
Me.tabs.TabIndex = 0
'
'Panel1 'Panel1
' '
Me.Panel1.Controls.Add(Me.btnhome) Me.Panel1.Controls.Add(Me.btnhome)
@ -276,17 +275,36 @@ Partial Class Web_Browser
' '
'pnloptions 'pnloptions
' '
Me.pnloptions.Controls.Add(Me.BrowserProgress)
Me.pnloptions.Controls.Add(Me.btnRemTab)
Me.pnloptions.Controls.Add(Me.btnAddTab)
Me.pnloptions.Controls.Add(Me.siteloadprogress) Me.pnloptions.Controls.Add(Me.siteloadprogress)
Me.pnloptions.Controls.Add(Me.pnltab4)
Me.pnloptions.Controls.Add(Me.pnltab3)
Me.pnloptions.Controls.Add(Me.pnltab2)
Me.pnloptions.Controls.Add(Me.pnltab1)
Me.pnloptions.Dock = System.Windows.Forms.DockStyle.Bottom Me.pnloptions.Dock = System.Windows.Forms.DockStyle.Bottom
Me.pnloptions.Location = New System.Drawing.Point(0, 523) Me.pnloptions.Location = New System.Drawing.Point(0, 523)
Me.pnloptions.Name = "pnloptions" Me.pnloptions.Name = "pnloptions"
Me.pnloptions.Size = New System.Drawing.Size(1054, 45) Me.pnloptions.Size = New System.Drawing.Size(1054, 45)
Me.pnloptions.TabIndex = 5 Me.pnloptions.TabIndex = 5
' '
'btnRemTab
'
Me.btnRemTab.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnRemTab.Location = New System.Drawing.Point(93, 16)
Me.btnRemTab.Name = "btnRemTab"
Me.btnRemTab.Size = New System.Drawing.Size(81, 23)
Me.btnRemTab.TabIndex = 22
Me.btnRemTab.Text = "Remove Tab"
Me.btnRemTab.UseVisualStyleBackColor = True
'
'btnAddTab
'
Me.btnAddTab.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnAddTab.Location = New System.Drawing.Point(6, 16)
Me.btnAddTab.Name = "btnAddTab"
Me.btnAddTab.Size = New System.Drawing.Size(81, 23)
Me.btnAddTab.TabIndex = 21
Me.btnAddTab.Text = "Add Tab"
Me.btnAddTab.UseVisualStyleBackColor = True
'
'siteloadprogress 'siteloadprogress
' '
Me.siteloadprogress.BackColor = System.Drawing.Color.White Me.siteloadprogress.BackColor = System.Drawing.Color.White
@ -307,87 +325,6 @@ Partial Class Web_Browser
Me.siteloadprogress.TabIndex = 20 Me.siteloadprogress.TabIndex = 20
Me.siteloadprogress.Value = 0 Me.siteloadprogress.Value = 0
' '
'pnltab4
'
Me.pnltab4.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.pnltab4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.pnltab4.Controls.Add(Me.lbltab4)
Me.pnltab4.Location = New System.Drawing.Point(513, 15)
Me.pnltab4.Name = "pnltab4"
Me.pnltab4.Size = New System.Drawing.Size(170, 26)
Me.pnltab4.TabIndex = 19
'
'lbltab4
'
Me.lbltab4.AutoSize = True
Me.lbltab4.BackColor = System.Drawing.Color.Transparent
Me.lbltab4.Location = New System.Drawing.Point(5, 7)
Me.lbltab4.Name = "lbltab4"
Me.lbltab4.Size = New System.Drawing.Size(56, 13)
Me.lbltab4.TabIndex = 1
Me.lbltab4.Text = "Blank Tab"
'
'pnltab3
'
Me.pnltab3.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.pnltab3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.pnltab3.Controls.Add(Me.lbltab3)
Me.pnltab3.Location = New System.Drawing.Point(344, 15)
Me.pnltab3.Name = "pnltab3"
Me.pnltab3.Size = New System.Drawing.Size(170, 26)
Me.pnltab3.TabIndex = 18
'
'lbltab3
'
Me.lbltab3.AutoSize = True
Me.lbltab3.BackColor = System.Drawing.Color.Transparent
Me.lbltab3.Location = New System.Drawing.Point(4, 7)
Me.lbltab3.Name = "lbltab3"
Me.lbltab3.Size = New System.Drawing.Size(56, 13)
Me.lbltab3.TabIndex = 1
Me.lbltab3.Text = "Blank Tab"
'
'pnltab2
'
Me.pnltab2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.pnltab2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.pnltab2.Controls.Add(Me.lbltab2)
Me.pnltab2.Location = New System.Drawing.Point(175, 15)
Me.pnltab2.Name = "pnltab2"
Me.pnltab2.Size = New System.Drawing.Size(170, 26)
Me.pnltab2.TabIndex = 17
'
'lbltab2
'
Me.lbltab2.AutoSize = True
Me.lbltab2.BackColor = System.Drawing.Color.Transparent
Me.lbltab2.Location = New System.Drawing.Point(3, 7)
Me.lbltab2.Name = "lbltab2"
Me.lbltab2.Size = New System.Drawing.Size(56, 13)
Me.lbltab2.TabIndex = 1
Me.lbltab2.Text = "Blank Tab"
'
'pnltab1
'
Me.pnltab1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.pnltab1.BackColor = System.Drawing.SystemColors.ControlLight
Me.pnltab1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.pnltab1.Controls.Add(Me.lbltab1)
Me.pnltab1.Location = New System.Drawing.Point(6, 15)
Me.pnltab1.Name = "pnltab1"
Me.pnltab1.Size = New System.Drawing.Size(170, 26)
Me.pnltab1.TabIndex = 16
'
'lbltab1
'
Me.lbltab1.AutoSize = True
Me.lbltab1.BackColor = System.Drawing.Color.Transparent
Me.lbltab1.Location = New System.Drawing.Point(3, 7)
Me.lbltab1.Name = "lbltab1"
Me.lbltab1.Size = New System.Drawing.Size(56, 13)
Me.lbltab1.TabIndex = 0
Me.lbltab1.Text = "Blank Tab"
'
'pgleft 'pgleft
' '
Me.pgleft.BackColor = System.Drawing.Color.Gray Me.pgleft.BackColor = System.Drawing.Color.Gray
@ -427,33 +364,36 @@ Partial Class Web_Browser
Me.pnlicon.TabStop = False Me.pnlicon.TabStop = False
Me.pnlicon.Visible = False Me.pnlicon.Visible = False
' '
'webwindowt1 'TabText
' '
Me.webwindowt1.Location = New System.Drawing.Point(100, 62) Me.TabText.Enabled = True
Me.webwindowt1.Name = "webwindowt1"
Me.webwindowt1.Size = New System.Drawing.Size(135, 84)
Me.webwindowt1.TabIndex = 0
' '
'webwindowt2 'UrlText
' '
Me.webwindowt2.Location = New System.Drawing.Point(352, 122) Me.UrlText.Enabled = True
Me.webwindowt2.Name = "webwindowt2"
Me.webwindowt2.Size = New System.Drawing.Size(75, 23)
Me.webwindowt2.TabIndex = 1
' '
'webwindowt3 'Progress
' '
Me.webwindowt3.Location = New System.Drawing.Point(476, 122)
Me.webwindowt3.Name = "webwindowt3"
Me.webwindowt3.Size = New System.Drawing.Size(75, 23)
Me.webwindowt3.TabIndex = 2
' '
'webwindowt4 'BrowserProgress
' '
Me.webwindowt4.Location = New System.Drawing.Point(218, 175) Me.BrowserProgress.BackColor = System.Drawing.Color.Black
Me.webwindowt4.Name = "webwindowt4" Me.BrowserProgress.BlockSeparation = 3
Me.webwindowt4.Size = New System.Drawing.Size(75, 23) Me.BrowserProgress.BlockWidth = 5
Me.webwindowt4.TabIndex = 3 Me.BrowserProgress.Color = System.Drawing.Color.Lime
Me.BrowserProgress.ForeColor = System.Drawing.SystemColors.ActiveCaption
Me.BrowserProgress.Location = New System.Drawing.Point(894, 16)
Me.BrowserProgress.MaxValue = 100
Me.BrowserProgress.MinValue = 0
Me.BrowserProgress.Name = "BrowserProgress"
Me.BrowserProgress.Orientation = ShiftOS.ProgressBarEX.ProgressBarOrientation.Horizontal
Me.BrowserProgress.ShowValue = True
Me.BrowserProgress.Size = New System.Drawing.Size(150, 23)
Me.BrowserProgress.Step = 10
Me.BrowserProgress.Style = ShiftOS.ProgressBarEX.ProgressBarExStyle.Blocks
Me.BrowserProgress.TabIndex = 23
Me.BrowserProgress.Value = 0
Me.BrowserProgress.Visible = False
' '
'Web_Browser 'Web_Browser
' '
@ -476,14 +416,6 @@ Partial Class Web_Browser
Me.Panel1.ResumeLayout(False) Me.Panel1.ResumeLayout(False)
Me.Panel1.PerformLayout() Me.Panel1.PerformLayout()
Me.pnloptions.ResumeLayout(False) Me.pnloptions.ResumeLayout(False)
Me.pnltab4.ResumeLayout(False)
Me.pnltab4.PerformLayout()
Me.pnltab3.ResumeLayout(False)
Me.pnltab3.PerformLayout()
Me.pnltab2.ResumeLayout(False)
Me.pnltab2.PerformLayout()
Me.pnltab1.ResumeLayout(False)
Me.pnltab1.PerformLayout()
Me.pgleft.ResumeLayout(False) Me.pgleft.ResumeLayout(False)
Me.titlebar.ResumeLayout(False) Me.titlebar.ResumeLayout(False)
Me.titlebar.PerformLayout() Me.titlebar.PerformLayout()
@ -515,18 +447,13 @@ Partial Class Web_Browser
Friend WithEvents btnback As System.Windows.Forms.Button Friend WithEvents btnback As System.Windows.Forms.Button
Friend WithEvents Panel2 As System.Windows.Forms.Panel Friend WithEvents Panel2 As System.Windows.Forms.Panel
Friend WithEvents pnloptions As System.Windows.Forms.Panel Friend WithEvents pnloptions As System.Windows.Forms.Panel
Friend WithEvents pnltab4 As System.Windows.Forms.Panel
Friend WithEvents lbltab4 As System.Windows.Forms.Label
Friend WithEvents pnltab3 As System.Windows.Forms.Panel
Friend WithEvents lbltab3 As System.Windows.Forms.Label
Friend WithEvents pnltab2 As System.Windows.Forms.Panel
Friend WithEvents lbltab2 As System.Windows.Forms.Label
Friend WithEvents pnltab1 As System.Windows.Forms.Panel
Friend WithEvents lbltab1 As System.Windows.Forms.Label
Friend WithEvents pnlwebtabholder As System.Windows.Forms.Panel Friend WithEvents pnlwebtabholder As System.Windows.Forms.Panel
Friend WithEvents siteloadprogress As ShiftOS.ProgressBarEX Friend WithEvents siteloadprogress As ShiftOS.ProgressBarEX
Friend WithEvents webwindowt4 As Skybound.Gecko.GeckoWebBrowser Friend WithEvents tabs As TabControl 'ShiftOS.ShiftOSTabs
Friend WithEvents webwindowt3 As Skybound.Gecko.GeckoWebBrowser Friend WithEvents btnAddTab As System.Windows.Forms.Button
Friend WithEvents webwindowt2 As Skybound.Gecko.GeckoWebBrowser Friend WithEvents btnRemTab As System.Windows.Forms.Button
Friend WithEvents webwindowt1 As Skybound.Gecko.GeckoWebBrowser Friend WithEvents TabText As System.Windows.Forms.Timer
Friend WithEvents UrlText As System.Windows.Forms.Timer
Friend WithEvents BrowserProgress As ShiftOS.ProgressBarEX
Friend WithEvents Progress As System.Windows.Forms.Timer
End Class End Class

View file

@ -126,4 +126,13 @@
<metadata name="pullbottom.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="pullbottom.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>195, 57</value> <value>195, 57</value>
</metadata> </metadata>
<metadata name="TabText.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>308, 57</value>
</metadata>
<metadata name="UrlText.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>397, 57</value>
</metadata>
<metadata name="Progress.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>487, 57</value>
</metadata>
</root> </root>

View file

@ -1,4 +1,6 @@
Public Class Web_Browser Imports Skybound.Gecko
Public Class Web_Browser
Public rolldownsize As Integer Public rolldownsize As Integer
Public oldbordersize As Integer Public oldbordersize As Integer
Public oldtitlebarheight As Integer Public oldtitlebarheight As Integer
@ -10,6 +12,7 @@
#Region "Template Code" #Region "Template Code"
Private Sub Template_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub Template_Load(sender As Object, e As EventArgs) Handles MyBase.Load
justopened = True justopened = True
Me.Left = (Screen.PrimaryScreen.Bounds.Width - Me.Width) / 2 Me.Left = (Screen.PrimaryScreen.Bounds.Width - Me.Width) / 2
Me.Top = (Screen.PrimaryScreen.Bounds.Height - Me.Height) / 2 Me.Top = (Screen.PrimaryScreen.Bounds.Height - Me.Height) / 2
@ -21,10 +24,11 @@
ShiftOSDesktop.setpanelbuttonappearnce(ShiftOSDesktop.pnlpanelbuttonwebbrowser, ShiftOSDesktop.tbwebbrowsericon, ShiftOSDesktop.tbwebbrowsertext, True) 'modify to proper name ShiftOSDesktop.setpanelbuttonappearnce(ShiftOSDesktop.pnlpanelbuttonwebbrowser, ShiftOSDesktop.tbwebbrowsericon, ShiftOSDesktop.tbwebbrowsertext, True) 'modify to proper name
ShiftOSDesktop.programsopen = ShiftOSDesktop.programsopen + 1 ShiftOSDesktop.programsopen = ShiftOSDesktop.programsopen + 1
gohome() addtab()
webwindowt1.BringToFront()
webwindowt1.Dock = DockStyle.Fill 'webwindowt1.BringToFront()
updatetabsizes() 'webwindowt1.Dock = DockStyle.Fill
End Sub End Sub
Public Sub setupall() Public Sub setupall()
@ -296,20 +300,20 @@
Private Sub pullside_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pullside.Tick Private Sub pullside_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pullside.Tick
Me.Width = Cursor.Position.X - Me.Location.X Me.Width = Cursor.Position.X - Me.Location.X
resettitlebar() resettitlebar()
updatetabsizes()
End Sub End Sub
Private Sub pullbottom_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pullbottom.Tick Private Sub pullbottom_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pullbottom.Tick
Me.Height = Cursor.Position.Y - Me.Location.Y Me.Height = Cursor.Position.Y - Me.Location.Y
resettitlebar() resettitlebar()
updatetabsizes()
End Sub End Sub
Private Sub pullbs_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles pullbs.Tick Private Sub pullbs_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles pullbs.Tick
Me.Width = Cursor.Position.X - Me.Location.X Me.Width = Cursor.Position.X - Me.Location.X
Me.Height = Cursor.Position.Y - Me.Location.Y Me.Height = Cursor.Position.Y - Me.Location.Y
resettitlebar() resettitlebar()
updatetabsizes()
End Sub End Sub
'delete this for non-resizable windows 'delete this for non-resizable windows
@ -430,228 +434,102 @@
'end of general setup 'end of general setup
#End Region #End Region
Dim currenttab As Integer = 1 'To re add gecko, replace all refrences to WebBrowser with Skybound.Gecko.GeckoWebBrowser. I would do it but i dont have the files!
Dim oldlocationtxt As String
Private Sub txtlocation_KeyDown(sender As Object, e As KeyEventArgs) Handles txtlocation.KeyDown Public Sub addtab()
If e.KeyCode = Keys.Enter Then Dim tab As New TabPage
Select Case currenttab Dim brwsr As New WebBrowser 'NEEDS TO CHANGE TO GECKO OR WEBKIT
Case 1 tabs.TabPages.Add(tab)
If txtlocation.Text.Contains(".") Then webwindowt1.Navigate(txtlocation.Text) Else webwindowt1.Navigate("http://www.google.com/search?q=" & txtlocation.Text) tab.Controls.Add(brwsr)
Case 2 brwsr.Dock = DockStyle.Fill
If txtlocation.Text.Contains(".") Then webwindowt2.Navigate(txtlocation.Text) Else webwindowt2.Navigate("http://www.google.com/search?q=" & txtlocation.Text) tabs.SelectedTab = tab
Case 3 brwsr.Navigate("http://www.google.com")
If txtlocation.Text.Contains(".") Then webwindowt3.Navigate(txtlocation.Text) Else webwindowt3.Navigate("http://www.google.com/search?q=" & txtlocation.Text)
Case 4
If txtlocation.Text.Contains(".") Then webwindowt4.Navigate(txtlocation.Text) Else webwindowt4.Navigate("http://www.google.com/search?q=" & txtlocation.Text)
End Select
End If
End Sub End Sub
Private Sub webwindowt1_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs) Private Sub btnAddTab_Click(sender As Object, e As EventArgs) Handles btnAddTab.Click
updatetitles() addtab()
txtlocation.Text = webwindowt1.Url.ToString
End Sub
Private Sub webwindowt2_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs)
updatetitles()
txtlocation.Text = webwindowt1.Url.ToString
End Sub
Private Sub webwindowt3_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs)
updatetitles()
txtlocation.Text = webwindowt1.Url.ToString
End Sub
Private Sub webwindowt4_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs)
updatetitles()
txtlocation.Text = webwindowt1.Url.ToString
End Sub End Sub
Private Sub updatetitles() Private Sub TabText_Tick(sender As Object, e As EventArgs) Handles TabText.Tick
Select Case currenttab For Each opentab As TabPage In tabs.TabPages
Case 1 For Each browser As WebBrowser In opentab.Controls
If Not webwindowt1.DocumentTitle = "" Then lbltab1.Text = webwindowt1.DocumentTitle opentab.Text = browser.DocumentTitle
If webwindowt1.DocumentTitle = "" Then lbtitletext.Text = ShiftOSDesktop.webbrowsername Else lbtitletext.Text = ShiftOSDesktop.webbrowsername & " - " & webwindowt1.DocumentTitle Next
centretitletext() Next
pnltab1.BackColor = Color.FromName("ControlLight")
pnltab2.BackColor = Color.White
pnltab3.BackColor = Color.White
pnltab4.BackColor = Color.White
Case 2
If Not webwindowt2.DocumentTitle = "" Then lbltab2.Text = webwindowt2.DocumentTitle
If webwindowt2.DocumentTitle = "" Then lbtitletext.Text = ShiftOSDesktop.webbrowsername Else lbtitletext.Text = ShiftOSDesktop.webbrowsername & " - " & webwindowt2.DocumentTitle
centretitletext()
pnltab2.BackColor = Color.FromName("ControlLight")
pnltab1.BackColor = Color.White
pnltab3.BackColor = Color.White
pnltab4.BackColor = Color.White
Case 3
If Not webwindowt3.DocumentTitle = "" Then lbltab3.Text = webwindowt3.DocumentTitle
If webwindowt3.DocumentTitle = "" Then lbtitletext.Text = ShiftOSDesktop.webbrowsername Else lbtitletext.Text = ShiftOSDesktop.webbrowsername & " - " & webwindowt3.DocumentTitle
centretitletext()
pnltab3.BackColor = Color.FromName("ControlLight")
pnltab2.BackColor = Color.White
pnltab1.BackColor = Color.White
pnltab4.BackColor = Color.White
Case 4
If Not webwindowt4.DocumentTitle = "" Then lbltab4.Text = webwindowt4.DocumentTitle
If webwindowt4.DocumentTitle = "" Then lbtitletext.Text = ShiftOSDesktop.webbrowsername Else lbtitletext.Text = ShiftOSDesktop.webbrowsername & " - " & webwindowt4.DocumentTitle
centretitletext()
pnltab4.BackColor = Color.FromName("ControlLight")
pnltab2.BackColor = Color.White
pnltab3.BackColor = Color.White
pnltab1.BackColor = Color.White
End Select
End Sub
Private Sub centretitletext()
If ShiftOSDesktop.boughttitletext = False Then
lbtitletext.Hide()
Else
lbtitletext.Font = New Font(ShiftOSDesktop.titletextfont, ShiftOSDesktop.titletextsize, ShiftOSDesktop.titletextstyle)
lbtitletext.Show()
End If
If ShiftOSDesktop.boughtwindowborders = True Then
closebutton.Location = New Point(titlebar.Size.Width - ShiftOSDesktop.closebuttonside - closebutton.Size.Width, ShiftOSDesktop.closebuttontop)
rollupbutton.Location = New Point(titlebar.Size.Width - ShiftOSDesktop.rollupbuttonside - rollupbutton.Size.Width, ShiftOSDesktop.rollupbuttontop)
minimizebutton.Location = New Point(titlebar.Size.Width - ShiftOSDesktop.minimizebuttonside - minimizebutton.Size.Width, ShiftOSDesktop.minimizebuttontop)
Select Case ShiftOSDesktop.titletextposition
Case "Left"
lbtitletext.Location = New Point(ShiftOSDesktop.titletextside, ShiftOSDesktop.titletexttop)
Case "Centre"
lbtitletext.Location = New Point((titlebar.Width / 2) - lbtitletext.Width / 2, ShiftOSDesktop.titletexttop)
End Select
lbtitletext.ForeColor = ShiftOSDesktop.titletextcolour
Else
closebutton.Location = New Point(titlebar.Size.Width - ShiftOSDesktop.closebuttonside - pgtoplcorner.Width - pgtoprcorner.Width - closebutton.Size.Width, ShiftOSDesktop.closebuttontop)
rollupbutton.Location = New Point(titlebar.Size.Width - ShiftOSDesktop.rollupbuttonside - pgtoplcorner.Width - pgtoprcorner.Width - rollupbutton.Size.Width, ShiftOSDesktop.rollupbuttontop)
minimizebutton.Location = New Point(titlebar.Size.Width - ShiftOSDesktop.minimizebuttonside - pgtoplcorner.Width - pgtoprcorner.Width - minimizebutton.Size.Width, ShiftOSDesktop.minimizebuttontop)
Select Case ShiftOSDesktop.titletextposition
Case "Left"
lbtitletext.Location = New Point(ShiftOSDesktop.titletextside + pgtoplcorner.Width, ShiftOSDesktop.titletexttop)
Case "Centre"
lbtitletext.Location = New Point((titlebar.Width / 2) - lbtitletext.Width / 2, ShiftOSDesktop.titletexttop)
End Select
lbtitletext.ForeColor = ShiftOSDesktop.titletextcolour
End If
End Sub End Sub
Private Sub btnback_Click(sender As Object, e As EventArgs) Handles btnback.Click Private Sub btnback_Click(sender As Object, e As EventArgs) Handles btnback.Click
Select Case currenttab
Case 1
If webwindowt1.CanGoBack = True Then webwindowt1.GoBack()
Case 2
If webwindowt2.CanGoBack = True Then webwindowt2.GoBack()
Case 3
If webwindowt3.CanGoBack = True Then webwindowt3.GoBack()
Case 4
If webwindowt4.CanGoBack = True Then webwindowt4.GoBack()
End Select
End Sub
Private Sub btnforward_Click(sender As Object, e As EventArgs) Handles btnforward.Click
Select Case currenttab
Case 1
If webwindowt1.CanGoForward = True Then webwindowt1.GoForward()
Case 2
If webwindowt2.CanGoForward = True Then webwindowt2.GoForward()
Case 3
If webwindowt3.CanGoForward = True Then webwindowt3.GoForward()
Case 4
If webwindowt4.CanGoForward = True Then webwindowt4.GoForward()
End Select
End Sub
Private Sub gohome()
Select Case currenttab
Case 1
webwindowt1.Navigate(ShiftOSDesktop.webbrowserhomepage)
centretitletext()
Case 2
webwindowt2.Navigate(ShiftOSDesktop.webbrowserhomepage)
centretitletext()
Case 3
webwindowt3.Navigate(ShiftOSDesktop.webbrowserhomepage)
centretitletext()
Case 4
webwindowt4.Navigate(ShiftOSDesktop.webbrowserhomepage)
centretitletext()
End Select
End Sub
Private Sub btnhome_Click(sender As Object, e As EventArgs) Handles btnhome.Click
gohome()
End Sub
Private Sub txtlocation_MouseClick(sender As Object, e As MouseEventArgs) Handles txtlocation.MouseClick
txtlocation.SelectAll()
End Sub
Private Sub txtlocation_mouseenter(sender As Object, e As EventArgs) Handles txtlocation.GotFocus
oldlocationtxt = txtlocation.Text
txtlocation.Text = ""
End Sub
Private Sub txtlocation_mouseleave(sender As Object, e As EventArgs) Handles txtlocation.LostFocus
If txtlocation.Text = "" Then txtlocation.Text = oldlocationtxt
End Sub
'switching tabs
Private Sub pnltab1_Click(sender As Object, e As EventArgs) Handles pnltab1.Click
currenttab = 1
webwindowt1.Dock = DockStyle.Fill
webwindowt1.BringToFront()
updatetitles()
txtlocation.Text = "Search or Enter an address"
If webwindowt1.DocumentTitle = "" Then lbtitletext.Text = "Web Browser" Else lbtitletext.Text = "Web Browser - " & webwindowt1.DocumentTitle
End Sub
Private Sub pnltab2_Click(sender As Object, e As EventArgs) Handles pnltab2.Click
currenttab = 2
webwindowt2.Dock = DockStyle.Fill
webwindowt2.BringToFront()
updatetitles()
txtlocation.Text = "Search or Enter an address"
If webwindowt2.DocumentTitle = "" Then lbtitletext.Text = "Web Browser" Else lbtitletext.Text = "Web Browser - " & webwindowt2.DocumentTitle
End Sub
Private Sub pnltab3_Click(sender As Object, e As EventArgs) Handles pnltab3.Click
currenttab = 3
webwindowt3.Dock = DockStyle.Fill
webwindowt3.BringToFront()
updatetitles()
txtlocation.Text = "Search or Enter an address"
If webwindowt3.DocumentTitle = "" Then lbtitletext.Text = "Web Browser" Else lbtitletext.Text = "Web Browser - " & webwindowt3.DocumentTitle
End Sub
Private Sub pnltab4_Click(sender As Object, e As EventArgs) Handles pnltab4.Click
currenttab = 4
webwindowt4.Dock = DockStyle.Fill
webwindowt4.BringToFront()
updatetitles()
txtlocation.Text = "Search or Enter an address"
If webwindowt4.DocumentTitle = "" Then lbtitletext.Text = "Web Browser" Else lbtitletext.Text = "Web Browser - " & webwindowt4.DocumentTitle
End Sub
Private Sub webloading(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs)
Try Try
If e.MaximumProgress > 0L AndAlso e.CurrentProgress > 0L Then CType(tabs.SelectedTab.Controls.Item(0), WebBrowser).GoBack()
siteloadprogress.Value = CInt(Math.Round((100 * e.CurrentProgress / e.MaximumProgress))) Catch
ElseIf e.MaximumProgress = 0L AndAlso e.CurrentProgress = 0L Then
siteloadprogress.Value = 0
End If
Catch ex As Exception
siteloadprogress.Value = 0
End Try End Try
End Sub End Sub
Private Sub updatetabsizes() Private Sub UrlText_Tick(sender As Object, e As EventArgs) Handles UrlText.Tick
Dim totalsize As Integer = Me.Width - pgleft.Width - pgright.Width - 10 Try
pnltab1.Size = New Size(totalsize / 4, pnltab1.Height) txtlocation.Text = (CType(tabs.SelectedTab.Controls.Item(0), WebBrowser).Url.AbsoluteUri.ToString)
pnltab2.Size = New Size(totalsize / 4, pnltab2.Height) Catch
pnltab3.Size = New Size(totalsize / 4, pnltab3.Height) End Try
pnltab4.Size = New Size(totalsize / 4, pnltab4.Height) End Sub
pnltab2.Location = New Point(pgleft.Width + 5 + pnltab1.Width, pnltab2.Location.Y)
pnltab3.Location = New Point(pgleft.Width + 5 + pnltab1.Width + pnltab2.Width, pnltab3.Location.Y) Private Sub txtlocation_Click(sender As Object, e As EventArgs) Handles txtlocation.Click
pnltab4.Location = New Point(pgleft.Width + 5 + pnltab1.Width + pnltab2.Width + pnltab3.Width, pnltab4.Location.Y) txtlocation.Text = ""
UrlText.Stop()
End Sub
Private Sub txtlocation_LostFocus(sender As Object, e As EventArgs) Handles txtlocation.LostFocus
UrlText.Start()
End Sub
Private Sub btnforward_Click(sender As Object, e As EventArgs) Handles btnforward.Click
Try
CType(tabs.SelectedTab.Controls.Item(0), WebBrowser).GoForward()
Catch
End Try
End Sub
Private Sub btnhome_Click(sender As Object, e As EventArgs) Handles btnhome.Click
If tabs.TabCount > 1 Then
Try
CType(tabs.SelectedTab.Controls.Item(0), WebBrowser).Navigate("http://www.google.com")
Catch
End Try
Else
addtab()
Try
CType(tabs.SelectedTab.Controls.Item(0), WebBrowser).Navigate("http://www.google.com")
Catch
End Try
End If
End Sub
Private Sub Web_Browser_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles Me.PreviewKeyDown
End Sub
Private Sub txtlocation_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles txtlocation.PreviewKeyDown
If tabs.TabCount > 1 Then
If e.KeyCode = Keys.Enter Then
CType(tabs.SelectedTab.Controls.Item(0), WebBrowser).Navigate(txtlocation.Text)
End If
Else
If e.KeyCode = Keys.Enter Then
addtab()
CType(tabs.SelectedTab.Controls.Item(0), WebBrowser).Navigate(txtlocation.Text)
End If
End If
End Sub
Private Sub btnRemTab_Click(sender As Object, e As EventArgs) Handles btnRemTab.Click
If tabs.TabCount > 1 Then
tabs.Controls.Remove(tabs.SelectedTab)
Else
tabs.Controls.Remove(tabs.SelectedTab)
Me.Close()
End If
End Sub
Private Sub Progress_Tick(sender As Object, e As EventArgs) Handles Progress.Tick
'BrowserProgress.MaxValue = (CType(tabs.SelectedTab.Controls.Item(0), WebBrowser)
End Sub End Sub
End Class End Class