summaryrefslogtreecommitdiff
path: root/lib/bottompanel/bottomnotebook.tcl
diff options
context:
space:
mode:
authorAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:31 +0200
committerAndrej Shadura <andrewsh@debian.org>2018-05-08 15:59:31 +0200
commit47aa8b00b2b11df13a100489e0f904a4947177ef (patch)
treeb35c9acc778ea2f761f3c549f7bee2f4491b3144 /lib/bottompanel/bottomnotebook.tcl
parent5b8466f7fae0e071c0f4eda13051c93313910028 (diff)
Import Upstream version 1.4.7
Diffstat (limited to 'lib/bottompanel/bottomnotebook.tcl')
-rw-r--r--[-rwxr-xr-x]lib/bottompanel/bottomnotebook.tcl291
1 files changed, 126 insertions, 165 deletions
diff --git a/lib/bottompanel/bottomnotebook.tcl b/lib/bottompanel/bottomnotebook.tcl
index 463f93d..d4d1293 100755..100644
--- a/lib/bottompanel/bottomnotebook.tcl
+++ b/lib/bottompanel/bottomnotebook.tcl
@@ -2,7 +2,7 @@
# Part of MCU 8051 IDE ( http://mcu8051ide.sf.net )
############################################################################
-# Copyright (C) 2007-2009 by Martin Ošmera #
+# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera #
# martin.osmera@gmail.com #
# #
# This program is free software; you can redistribute it and#or modify #
@@ -21,6 +21,11 @@
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
+# >>> File inclusion guard
+if { ! [ info exists _BOTTOMNOTEBOOK_TCL ] } {
+set _BOTTOMNOTEBOOK_TCL _
+# <<< File inclusion guard
+
# --------------------------------------------------------------------------
# DESCRIPTION
# Implements bottom panel of the project tab
@@ -45,14 +50,13 @@ class BottomNoteBook {
public variable cvarsview_frame ;# Identifier of tab of NoteBook widget for c variables
public variable graph_frame ;# Identifier of tab of NoteBook widget for graph
public variable messages_frame ;# Identifier of tab of NoteBook widget for messages box
- public variable todo_frame ;# Identifier of tab of NoteBook widget for todo box
+ public variable todo_frame ;# Identifier of tab of NoteBook widget for to do box
public variable calculator_frame ;# Identifier of tab of NoteBook widget for calculator
public variable terminal_frame ;# Identifier of tab of NoteBook widget for terminal
public variable findinfiles_frame ;# Identifier of tab of NoteBook widget for terminal
## Private
private variable pri_notebook ;# Identifier of NoteBook widget when panel is visible
- private variable sec_notebook ;# Identifier of NoteBook widget when panel is hidden
private variable main_frame ;# Identifier of frame containing both NoteBooks
private variable panel_hidding_ena 1 ;# Is panel hidding enabled
@@ -69,10 +73,10 @@ class BottomNoteBook {
if {$active_page == {Terminal}} {
set active_page {Simulator}
} elseif {
- [lsearch {Simulator CVarsView Graph Messages Todo Calculator FindInFiles} $active_page] == -1
- } {
- puts stderr "Invalid value of active page '$active_page', setting to {Simulator}"
- set active_page {Simulator}
+ [lsearch {Simulator CVarsView Graph Messages Todo Calculator FindInFiles} $active_page] == -1
+ } then {
+ puts stderr "Invalid value of active page '$active_page', setting to {Simulator}"
+ set active_page {Simulator}
}
}
@@ -86,11 +90,11 @@ class BottomNoteBook {
## Create Bottom NoteBook (This function must be called after contructor)
# @parm widget mainframe - Frame for bottom notebook
# @parm widget PaneWindow - parent pane window contaier
- # @parm String todoText - content of todo text
+ # @parm String todoText - content of to do text
# @parm List calculatorList - List of values for calculator (display content, radix, etc.)
# @parm List graph_config - Graph configuration list
# @return Widget - ID of frame containg both notebooks
- public method initiate_BottomNoteBook {mainframe PaneWindow todoText calculatorList graph_config} {
+ public method initalize_BottomNoteBook {mainframe PaneWindow todoText calculatorList graph_config} {
# set parent pane window
set parentPane $PaneWindow
@@ -99,18 +103,7 @@ class BottomNoteBook {
# Frame for primary and secondary notebook
set main_frame $mainframe
# Primary notebook
- set pri_notebook [NoteBook $main_frame.ntb_bottomNB_pri \
- -side top -bd 1 \
- -arcradius 4 -bg {#EEEEEE} \
- -font [font create -family {helvetica} -size -12 -weight bold] \
- ]
- # Secondary notebook
- set sec_notebook [NoteBook $main_frame.ntb_bottomNB_sec \
- -side top \
- -arcradius 4 \
- -borderwidth 1 -bg {#EEEEEE} \
- -font [font create -family {helvetica} -size -12 -weight bold] \
- ]
+ set pri_notebook [ModernNoteBook $main_frame.ntb_bottomNB_pri]
# Register notebook status bar tips
notebook_Sbar_set {bottomnb} [list \
@@ -127,150 +120,92 @@ class BottomNoteBook {
]
$pri_notebook bindtabs <Enter> "notebook_Sbar bottomnb"
$pri_notebook bindtabs <Leave> "Sbar {} ;#"
- $sec_notebook bindtabs <Enter> "notebook_Sbar bottomnb"
- $sec_notebook bindtabs <Leave> "Sbar {} ;#"
## create Primary NoteBook tabs
# Tab "Simulator"
- set simulator_frame [$pri_notebook insert end {Simulator} \
- -text [mc "Simulator"] \
- -image ::ICONS::16::kcmmemory \
- -raisecmd "$this bottomNB_set_active_page {Simulator}" \
- -helptext [mc "Simulator panel %s" "(Ctrl+1)"] \
- -createcmd [list $this CreateSimulatorGUI] \
+ set simulator_frame [$pri_notebook insert end {Simulator} \
+ -text [mc "Simulator"] \
+ -image ::ICONS::16::kcmmemory \
+ -raisecmd [list $this bottomNB_set_active_page {Simulator}] \
+ -helptext [mc "Simulator panel %s" "(Ctrl+1)"] \
+ -createcmd [list $this CreateSimulatorGUI] \
]
# Tab "C variables"
- set cvarsview_frame [$pri_notebook insert end {CVarsView} \
- -text [mc "C variables"] \
- -image ::ICONS::16::player_playlist \
- -raisecmd "$this bottomNB_set_active_page {CVarsView}" \
- -helptext [mc "Variables from C source code %s" ""] \
- -createcmd [list $this CreateCVarsViewGUI] \
+ set cvarsview_frame [$pri_notebook insert end {CVarsView} \
+ -text [mc "C variables"] \
+ -image ::ICONS::16::player_playlist \
+ -raisecmd [list $this bottomNB_set_active_page {CVarsView}] \
+ -helptext [mc "Variables from C source code %s" ""] \
+ -createcmd [list $this CreateCVarsViewGUI] \
]
# Tab "Graph"
set graph_frame [$pri_notebook insert end {Graph} \
-text [mc "IO Ports"] \
-image ::ICONS::16::graph \
- -raisecmd "$this bottomNB_set_active_page {Graph}" \
+ -raisecmd [list $this bottomNB_set_active_page {Graph}] \
-helptext [mc "Graph showing state of MCU ports %s" "(Ctrl+2)"] \
-createcmd [list $this CreateGraphGUI] \
]
# Tab "Messages"
- set messages_frame [$pri_notebook insert end {Messages} \
- -text [mc "Messages"] \
- -image ::ICONS::16::kcmsystem \
- -raisecmd "$this bottomNB_set_active_page {Messages}" \
- -helptext [mc "Compiler messages %s" "(Ctrl+3)"] \
- -createcmd [list $this CreateMessagesGUI] \
+ set messages_frame [$pri_notebook insert end {Messages} \
+ -text [mc "Messages"] \
+ -image ::ICONS::16::kcmsystem \
+ -raisecmd [list $this bottomNB_set_active_page {Messages}] \
+ -helptext [mc "Compiler messages %s" "(Ctrl+3)"] \
+ -createcmd [list $this CreateMessagesGUI] \
+ -leavecmd "
+ $pri_notebook itemconfigure {Messages} -image ::ICONS::16::kcmsystem
+ " \
]
# Tab "Notes"
set todo_frame [$pri_notebook insert end {Todo} \
-text [mc "Notes"] \
-image ::ICONS::16::camera_test \
- -raisecmd "$this bottomNB_set_active_page {Todo}" \
- -helptext [mc "Personal todo list & notepad %s" "(Ctrl+4)"]\
+ -raisecmd [list $this bottomNB_set_active_page {Todo}] \
+ -helptext [mc "Personal to do list & notepad %s" "(Ctrl+4)"]\
-createcmd [list $this CreateTodoGUI] \
]
# Tab "Calculator"
- set calculator_frame [$pri_notebook insert end {Calculator} \
- -text [mc "Calculator"] \
- -image ::ICONS::16::xcalc \
- -raisecmd "$this bottomNB_set_active_page {Calculator}" \
- -helptext [mc "Scientific calculator %s" "(Ctrl+5)"] \
- -createcmd [list $this CreateCalculatorGUI] \
+ set calculator_frame [$pri_notebook insert end {Calculator} \
+ -text [mc "Calculator"] \
+ -image ::ICONS::16::xcalc \
+ -raisecmd [list $this bottomNB_set_active_page {Calculator}] \
+ -helptext [mc "Scientific calculator %s" "(Ctrl+5)"] \
+ -createcmd [list $this CreateCalculatorGUI] \
]
if {!$::MICROSOFT_WINDOWS} { ;# Microsoft Windows has no terminal emulator
# Tab "Terminal"
- set terminal_frame [$pri_notebook insert end {Terminal} \
- -text [mc "Terminal"] \
- -image ::ICONS::16::terminal \
- -raisecmd "$this bottomNB_set_active_page {Terminal}" \
- -helptext [mc "Terminal emulator %s" ""] \
- -createcmd [list $this CreateTerminalEmulGUI] \
- -state [expr {${::PROGRAM_AVALIABLE(urxvt)} ? "normal" : "disabled"}] \
+ set terminal_frame [$pri_notebook insert end {Terminal} \
+ -text [mc "Terminal"] \
+ -image ::ICONS::16::terminal \
+ -raisecmd [list $this bottomNB_set_active_page {Terminal}] \
+ -helptext [mc "Terminal emulator %s" ""] \
+ -createcmd [list $this CreateTerminalEmulGUI] \
+ -state [expr {${::PROGRAM_AVAILABLE(urxvt)} ? "normal" : "disabled"}] \
]
}
# Tab "Find in files"
- set findinfiles_frame [$pri_notebook insert end {FindInFiles} \
- -text [mc "Find in files"] \
- -image ::ICONS::16::filefind \
- -raisecmd "$this bottomNB_set_active_page {FindInFiles}"\
- -helptext [mc "Find in files %s" ""] \
- -createcmd [list $this CreateFindInFilesGUI] \
+ set findinfiles_frame [$pri_notebook insert end {FindInFiles} \
+ -text [mc "Find in files"] \
+ -image ::ICONS::16::filefind \
+ -raisecmd [list $this bottomNB_set_active_page {FindInFiles}] \
+ -helptext [mc "Find in files %s" ""] \
+ -createcmd [list $this CreateFindInFilesGUI] \
]
# Tab "Hide"
- $pri_notebook insert end {Hide} \
- -text [mc "Hide"] \
- -image ::ICONS::16::2downarrow \
- -raisecmd "$this bottomNB_show_hide" \
- -helptext [mc "Hide this panel"] \
-
- ## Create Secondary NoteBook tabs
- # tab "Simulator"
- $sec_notebook insert end {Simulator} \
- -text [mc "Simulator"] \
- -image ::ICONS::16::kcmmemory \
- -raisecmd "$this bottomNB_show_hide Simulator" \
- -helptext [mc "Simulator panel %s" "(Ctrl+1)"]
- # tab "C variables"
- $sec_notebook insert end {CVarsView} \
- -text [mc "C variables"] \
- -image ::ICONS::16::player_playlist \
- -raisecmd "$this bottomNB_show_hide CVarsView" \
- -helptext [mc "Variables from C source code %s" ""]
- # tab "Graph"
- $sec_notebook insert end {Graph} \
- -text [mc "IO Ports"] \
- -image ::ICONS::16::graph \
- -raisecmd "$this bottomNB_show_hide Graph" \
- -helptext [mc "Graph showing state of MCU ports %s" "(Ctrl+2)"]
- # tab "Messages"
- $sec_notebook insert end {Messages} \
- -text [mc "Messages"] \
- -image ::ICONS::16::kcmsystem \
- -raisecmd "$this bottomNB_show_hide Messages" \
- -helptext [mc "Compiler messages %s" "(Ctrl+3)"]
- # tab "Notes"
- $sec_notebook insert end {Todo} \
- -text [mc "Notes"] \
- -image ::ICONS::16::camera_test \
- -raisecmd "$this bottomNB_show_hide Todo" \
- -helptext [mc "Personal todo list & notepad %s" "(Ctrl+4)"]
- # tab "Calculator"
- $sec_notebook insert end {Calculator} \
- -text [mc "Calculator"] \
- -image ::ICONS::16::xcalc \
- -raisecmd "$this bottomNB_show_hide Calculator" \
- -helptext [mc "Scientific calculator %s" "(Ctrl+5)"]
- if {!$::MICROSOFT_WINDOWS} { ;# Microsoft Windows has no terminal emulator
- # tab "Terminal"
- $sec_notebook insert end {Terminal} \
- -text [mc "Terminal"] \
- -image ::ICONS::16::terminal \
- -raisecmd "$this bottomNB_show_hide Terminal" \
- -helptext [mc "Terminal emulator %s" ""] \
- -state [expr {${::PROGRAM_AVALIABLE(urxvt)} ? "normal" : "disabled"}]
- }
- # tab "Find in files"
- $sec_notebook insert end {FindInFiles} \
- -text [mc "Find in files"] \
- -image ::ICONS::16::filefind \
- -raisecmd "$this bottomNB_show_hide FindInFiles" \
- -helptext [mc "Find in files %s" ""] \
- -createcmd [list $this CreateFindInFilesGUI]
- # tab "Show"
- $sec_notebook insert end {Show} \
- -text [mc "Show"] \
- -image ::ICONS::16::2uparrow \
- -raisecmd "$this bottomNB_show_hide" \
- -helptext [mc "Show this panel"]
+ $pri_notebook insert end {Hide} \
+ -text [mc "Hide"] \
+ -image ::ICONS::16::2downarrow \
+ -raisecmd [list $this bottomNB_show_hide] \
+ -helptext [mc "Hide this panel"] \
# Prepare panel componenets but do not create GUI elements
PrepareCalculator $calculator_frame $calculatorList
PrepareGraph $graph_frame $graph_config
PrepareMessages $messages_frame
PrepareTodo $todo_frame $todoText
+
PrepareSimulator $simulator_frame
PrepareCVarsView $cvarsview_frame
if {!$::MICROSOFT_WINDOWS} { ;# Microsoft Windows has no terminal emulator
@@ -278,25 +213,30 @@ class BottomNoteBook {
}
PrepareFindInFiles $findinfiles_frame
-
# take case of proper pane resizing
bind $parentPane <ButtonRelease-1> "$this bottomNB_panel_set_size"
# Show primary notebook if panel is visible or secondary notebook ohterwise
+ pack [$pri_notebook get_nb] -expand 1 -fill both -padx 5 -pady 5
if {$PanelVisible != 0} {
- pack $pri_notebook -expand 1 -fill both
- $parentPane paneconfigure $main_frame -minsize 190
- $parentPane configure -sashwidth 2
+ $parentPane paneconfigure $main_frame -minsize 215
+ $parentPane configure -sashwidth 4
# Raise tab
catch {$pri_notebook raise $active_page}
- } {
- pack $sec_notebook -anchor nw -fill x -expand 1
+ } else {
+ $pri_notebook hide_pages_area
+ $pri_notebook deselect_tab_button
+ $pri_notebook itemconfigure {Hide} \
+ -text [mc "Show"] \
+ -image ::ICONS::16::2uparrow \
+ -helptext [mc "Show this panel"]
+
$parentPane paneconfigure $main_frame -minsize 0
$parentPane configure -sashwidth 0
bind $parentPane <Button> {break}
set last_PanelSize $PanelSize
- set PanelSize 24
+ set PanelSize 34
}
}
@@ -309,7 +249,7 @@ class BottomNoteBook {
public method getBottomPanelSize {} {
if {$PanelVisible} {
return $PanelSize
- } {
+ } else {
return $last_PanelSize
}
}
@@ -332,13 +272,18 @@ class BottomNoteBook {
Calculator {$this CalculatorTabRaised}
FindInFiles {$this FindInFilesTabRaised}
}
- set active_page $pageName
+ if {$pageName != {Hide}} {
+ set active_page $pageName
+ }
+ if {!$PanelVisible} {
+ bottomNB_show_hide
+ }
}
## Show or hide the panel
- # @parm String args = NULL - name of active page (show panel)
+ # @parm String a_page={} - name of active page (show panel)
# @return void
- public method bottomNB_show_hide args {
+ public method bottomNB_show_hide {{a_page {}}} {
# If panel hidding is disabled -- abort
if {!$panel_hidding_ena} {return}
@@ -347,17 +292,17 @@ class BottomNoteBook {
if {$PanelVisible} {
$parentPane paneconfigure $main_frame -minsize 0
- # Ged rid of primary notebook
- pack forget $pri_notebook ;# Hide primary notebook
+ $pri_notebook hide_pages_area
+ $pri_notebook deselect_tab_button
+ $pri_notebook itemconfigure {Hide} \
+ -text [mc "Show"] \
+ -image ::ICONS::16::2uparrow \
+ -helptext [mc "Show this panel"]
set last_PanelSize $PanelSize ;# Save current panel size
- set PanelSize 24 ;# Set New panel size
+ set PanelSize 34 ;# Set New panel size
bottomNB_redraw_pane ;# Perform hidding
- # Create and show secondary notebook
- pack $sec_notebook -anchor nw -fill x -expand 1
- $sec_notebook compute_size
set panel_hidding_ena 0
- $sec_notebook raise $active_page
set panel_hidding_ena 1
$parentPane configure -sashwidth 0
bind $parentPane <Button> {break}
@@ -366,32 +311,34 @@ class BottomNoteBook {
set PanelVisible 0
# Show the panel
- } {
- $parentPane paneconfigure $main_frame -minsize 190
+ } else {
+ $parentPane paneconfigure $main_frame -minsize 215
- # Hide secondary notebook
- pack forget $sec_notebook
+ $pri_notebook show_pages_area
+ $pri_notebook itemconfigure {Hide} \
+ -text [mc "Hide"] \
+ -image ::ICONS::16::2downarrow \
+ -helptext [mc "Hide this panel"]
# Create and show primary notebook
set PanelSize $last_PanelSize ;# Restore panel size
bottomNB_redraw_pane ;# Perform showing
+
# Raise active page
- if {$args == {}} {
+ if {$a_page == {}} {
$pri_notebook raise $active_page
- } {
- $pri_notebook raise $args
+ } else {
+ $pri_notebook raise $a_page
}
- # Pack primary notebook
- pack $pri_notebook -expand 1 -fill both
# Restore sash width
- $parentPane configure -sashwidth 2
+ $parentPane configure -sashwidth 4
bind $parentPane <Button> {}
# Panel is now shown
set PanelVisible 1
}
- update idle
+ update idletasks
$this editor_procedure {} Configure {}
}
@@ -401,7 +348,7 @@ class BottomNoteBook {
set PanelSize [lindex [$parentPane sash coord 0] 1]
set PanelSize [expr {[winfo height $parentPane] - $PanelSize}]
- update idle
+ update idletasks
$this editor_procedure {} Configure {}
$this editor_procedure {} goto \
[$this editor_procedure {} get_current_line_number {}]
@@ -411,15 +358,17 @@ class BottomNoteBook {
# @parm Int by - pixels
# @return void
public method bottomNB_move_pane_up {by} {
- update idle
+ update idletasks
$parentPane sash place 0 0 [expr {[winfo height $parentPane] - $PanelSize - $by}]
}
## Redraw panel pane
# @return void
public method bottomNB_redraw_pane {} {
- update idle
- $parentPane sash place 0 0 [expr {[winfo height $parentPane] - $PanelSize}]
+ update idletasks
+ catch {
+ $parentPane sash place 0 0 [expr {[winfo height $parentPane] - $PanelSize}]
+ }
}
## Redraw panel pane on expose event
@@ -431,9 +380,9 @@ class BottomNoteBook {
}
set redraw_pane_in_progress 1
- update idle
+ update idletasks
$parentPane sash place 0 0 [expr {[winfo height $parentPane] - $PanelSize}]
- update idle
+ update idletasks
set redraw_pane_in_progress 0
}
@@ -445,7 +394,7 @@ class BottomNoteBook {
public method bottomNB_show_up {page} {
if {$PanelVisible} {
$pri_notebook raise $page
- } {
+ } else {
bottomNB_show_hide $page
}
}
@@ -466,4 +415,16 @@ class BottomNoteBook {
public method graph_itialize_simulator_graph_panel {graph_config} {
$this graph_change_mcu
}
-} \ No newline at end of file
+
+ ## Configure particular page on bottom notebook widget
+ # @parm String page - Page ID
+ # @parm List options - Any options acceptable by the notebook widget
+ # @return void
+ public method bottomnotebook_pageconfigure {page options} {
+ eval "$pri_notebook itemconfigure {$page} $options"
+ }
+}
+
+# >>> File inclusion guard
+}
+# <<< File inclusion guard