Casting and Costume Management Application
Artifact [b79ccdb9cf]
Not logged in

Artifact b79ccdb9cf0cd1525b47b86e08c59e5dfa66d170:


###############################################################################
##                                                                           ##
##  Copyright (c) 2012 Gerald W. Lester                                      ##
##  All rights reserved.                                                     ##
##                                                                           ##
##  Redistribution and use in source and binary forms, with or without       ##
##  modification, are permitted provided that the following conditions       ##
##  are met:                                                                 ##
##                                                                           ##
##    * Redistributions of source code must retain the above copyright       ##
##      notice, this list of conditions and the following disclaimer.        ##
##    * Redistributions in binary form must reproduce the above              ##
##      copyright notice, this list of conditions and the following          ##
##      disclaimer in the documentation and/or other materials provided      ##
##      with the distribution.                                               ##
##    * Neither the name of the Visiprise Software, Inc nor the names        ##
##      of its contributors may be used to endorse or promote products       ##
##      derived from this software without specific prior written            ##
##      permission.                                                          ##
##                                                                           ##
##  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS      ##
##  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT        ##
##  LIMITED  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS       ##
##  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE           ##
##  COPYRIGHT OWNER OR  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,     ##
##  INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,    ##
##  BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;        ##
##  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER         ##
##  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT       ##
##  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR  OTHERWISE) ARISING IN       ##
##  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF  ADVISED OF THE         ##
##  POSSIBILITY OF SUCH DAMAGE.                                              ##
##                                                                           ##
###############################################################################

###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
# Procedure Name :
#
# Description : Get the type cross reference information for a service.
#
# Arguments :
#       mode            - Client|Server
#
# Returns : Nothing
#
# Side-Effects : None
#
# Exception Conditions : None
#
# Pre-requisite Conditions : None
#
# Original Author : Gerald W. Lester
#
###########################################################################
proc BuildMainWindow {} {
    ::log::log debug [info level 0]
    variable windows

    set windows(Main) .
    set windows(MainNotebook) .nb
    set windows(Mainmenu) .menuBar

    ##
    ## Configure the main window
    ##
    menu $windows(Mainmenu)
    $windows(Main) configure -menu $windows(Mainmenu)
    wm title $windows(Main) {Ballet Hysell Data Manager}
    wm protocol $windows(Main) WM_DELETE_WINDOW ExitApplication
    wm maxsize $windows(Main) [winfo screenwidth $windows(Main)] [winfo screenheight $windows(Main)]

    tk appname {Hysell}

    ##
    ## Build the main menu
    ##
    BuildMainMenu $windows(Main) $windows(Mainmenu)

    ##
    ## Build the notebook
    ##
    ttk::notebook $windows(MainNotebook)
    bind $windows(MainNotebook) <<NotebookTabChanged>>  {
        set systemInfo(CurrentTab) [%W select]
    }
    BuildAudtionTab $windows(MainNotebook)
    BuildCostumeTab $windows(MainNotebook)
    BuildPerformerTab $windows(MainNotebook)
    BuildShowTab $windows(MainNotebook)
    $windows(MainNotebook) add $windows(MainShowTab) \
        -state normal \
        -sticky nsew \
        -text {Show View} \
        -underline 0
    $windows(MainNotebook) add $windows(MainAuditionTab) \
        -state normal \
        -sticky nsew \
        -text {Audition View} \
        -underline 0
    $windows(MainNotebook) add $windows(MainPerformerTab) \
        -state normal \
        -sticky nsew \
        -text {Performer View} \
        -underline 0
    $windows(MainNotebook) add $windows(MainCostumeTab) \
        -state normal \
        -sticky nsew \
        -text {Costume View} \
        -underline 0

    ##
    ## Define resize behavior
    ##
    grid configure $windows(MainNotebook) -sticky nsew
    grid columnconfigure $windows(Main) $windows(MainNotebook) -weight 1
    grid rowconfigure $windows(Main) $windows(MainNotebook) -weight 1

    return
}


###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
# Procedure Name : BuildMainMenu
#
# Description : Build the menu for the main window.
#
# Arguments :
#       top         - Main window
#       menuWidget  - Menu widget for main window
#
# Returns : Nothing
#
# Side-Effects : None
#
# Exception Conditions : None
#
# Pre-requisite Conditions : None
#
# Original Author : Gerald W. Lester
#
###########################################################################
proc BuildMainMenu {top menuWidget} {
    ::log::log debug [info level 0]
    variable windows

    ##
    ## Add in File menu
    ##
    $menuWidget add cascade \
        -label {File} \
        -underline 0 \
        -menu $menuWidget.file
    menu $menuWidget.file
    $menuWidget.file add cascade \
        -label {Reports} \
        -underline 0 \
        -menu $menuWidget.file.report
    menu $menuWidget.file.report -postcommand [list BuildReportMenu $menuWidget.file.report]
    $menuWidget.file add separator
    $menuWidget.file add command \
        -label {Exit} \
        -underline 1 \
        -command [list after 1 ExitApplication]

    ##
    ## Add in track menu
    ##
    $menuWidget add cascade \
        -label {Settings} \
        -underline 0 \
        -menu $menuWidget.filter
    menu $menuWidget.filter
    $menuWidget.filter add cascade \
        -label {Export Controls} \
        -underline 1 \
        -menu $menuWidget.filter.export
    menu $menuWidget.filter.export
    $menuWidget.filter.export add checkbutton \
        -label {Selected Records} \
        -underline 10 \
        -offvalue 0 \
        -onvalue 1 \
        -variable systemInfo(ExportSelected)
    $menuWidget.filter.export add checkbutton \
        -label {Active Records} \
        -underline 1 \
        -offvalue 0 \
        -onvalue 1 \
        -variable systemInfo(ExportActive)
    $menuWidget.filter.export add checkbutton \
        -label {Reporting Records} \
        -underline 1 \
        -offvalue 0 \
        -onvalue 1 \
        -variable systemInfo(ExportReport)
    $menuWidget.filter.export add checkbutton \
        -label {Selected Show} \
        -underline 10 \
        -offvalue 0 \
        -onvalue 1 \
        -variable systemInfo(ExportShow)
    $menuWidget.filter add cascade \
        -label {Performer} \
        -underline 1 \
        -menu $menuWidget.filter.performer
    menu $menuWidget.filter.performer
    $menuWidget.filter.performer add checkbutton \
        -label {Selected Show Only} \
        -underline 10 \
        -offvalue 0 \
        -onvalue 1 \
        -command PopulatePerformers \
        -variable systemInfo(PerformerTracksShow)
    $menuWidget.filter.performer add checkbutton \
        -label {Selected Costume Only} \
        -underline 10 \
        -offvalue 0 \
        -onvalue 1 \
        -command PopulatePerformers \
        -variable systemInfo(PerformerTracksCostume)
    $menuWidget.filter.performer add checkbutton \
        -label {Active Records Only} \
        -underline 1 \
        -offvalue 0 \
        -onvalue 1 \
        -command PopulatePerformers \
        -variable systemInfo(PerformerFilterOnActive)
    $menuWidget.filter.performer add checkbutton \
        -label {Reporting Records Only} \
        -underline 1 \
        -offvalue 0 \
        -onvalue 1 \
        -command PopulatePerformers \
        -variable systemInfo(PerformerFilterOnReport)

    ##
    ## Add in Tools menu
    ##
    $menuWidget add cascade \
        -label {Tools} \
        -underline 0 \
        -menu $menuWidget.tools
    menu $menuWidget.tools
    $menuWidget.tools add command \
        -label {Costume Entry Screen} \
        -command DisplayCostumeEntryGui
    $menuWidget.tools add cascade \
        -label {Audition Entry Screen} \
        -menu $menuWidget.tools.audition
    menu $menuWidget.tools.audition
    $menuWidget.tools.audition add command \
        -label {Audition Entry Screen} \
        -command DisplayAuditionEntryGui
    $menuWidget.tools.audition add checkbutton \
        -label [::msgcat::mc EnterAuditionNumber] \
        -underline 1 \
        -offvalue N \
        -onvalue Y \
        -variable systemInfo(EnterAuditionNumber) \
        -command [list AdjustAuto systemInfo(EnterAuditionNumber) .auditionEntryGui.top.ent_auditionnumber]
    $menuWidget.tools add cascade \
        -label {Mass Update} \
        -underline 0 \
        -menu $menuWidget.tools.massupdate
    menu $menuWidget.tools.massupdate
    $menuWidget.tools.massupdate add checkbutton \
        -label {Enabled} \
        -underline 1 \
        -offvalue 0 \
        -onvalue 1 \
        -command ToggleMassupdateMode \
        -variable MassUpdate(Enabled)
    $menuWidget.tools.massupdate add separator
    $menuWidget.tools.massupdate add command \
        -label {Select All} \
        -state disabled \
        -command [list SelectCurrentView All]
    bind $top <Control-A> [list $menuWidget.tools.massupdate invoke {Select All}]
    bind $top <Control-a> [list $menuWidget.tools.massupdate invoke {Select All}]
    bind $top <Command-A> [list $menuWidget.tools.massupdate invoke {Select All}]
    bind $top <Command-a> [list $menuWidget.tools.massupdate invoke {Select All}]
    $menuWidget.tools.massupdate add command \
        -label {Select None} \
        -state disabled \
        -command [list SelectCurrentView None]
    bind $top <Control-N> [list $menuWidget.tools.massupdate invoke {Select None}]
    bind $top <Control-n> [list $menuWidget.tools.massupdate invoke {Select None}]
    bind $top <Command-N> [list $menuWidget.tools.massupdate invoke {Select None}]
    bind $top <Command-n> [list $menuWidget.tools.massupdate invoke {Select None}]
    $menuWidget.tools.massupdate add separator
    $menuWidget.tools.massupdate add command \
        -label {Mark Active} \
        -state disabled \
        -command [list MarkActive Y]
    $menuWidget.tools.massupdate add command \
        -label {Mark Inactive} \
        -state disabled \
        -command [list MarkActive N]
    $menuWidget.tools.massupdate add separator
    $menuWidget.tools.massupdate add command \
        -label {Mark In Report} \
        -state disabled \
        -command [list MarkInReport Y]
    $menuWidget.tools.massupdate add command \
        -label {Mark Not In Report} \
        -state disabled \
        -command [list MarkInReport N]
    $menuWidget.tools.massupdate add separator
    $menuWidget.tools.massupdate add command \
        -label {Mark In Show} \
        -state disabled \
        -command [list MarkInShow Y]
    $menuWidget.tools.massupdate add command \
        -label {Mark Not In Show} \
        -state disabled \
        -command [list MarkInShow N]
    $menuWidget.tools add separator
    $menuWidget.tools add command \
        -label {Copy Family Information} \
        -state disabled \
        -command {CopyFamilyInfo $windows(performerDetailedArrayName)}
    $menuWidget.tools add separator
    menu $menuWidget.tools.tables
    $menuWidget.tools add command \
        -label {Report Maintenance} \
        -command {ExportListMaintenance}
    $menuWidget.tools add cascade \
        -label {Table Maintenance} \
        -menu $menuWidget.tools.tables
    $menuWidget.tools.tables add command \
        -label {Shows} \
        -command {TableMaintenace Show}
    $menuWidget.tools.tables add command \
        -label {Costumes} \
        -command {TableMaintenace characters}
    $menuWidget.tools.tables add command \
        -label {Performers} \
        -command {TableMaintenace Performers}

    ##
    ## Add in Help menu
    ##
    $menuWidget add cascade \
        -label {Help} \
        -underline 0 \
        -menu $menuWidget.help
    menu $menuWidget.help


    return;
}