FreeBurn.cpp
上传用户:cnxinhai
上传日期:2013-08-06
资源大小:265k
文件大小:93k
- /* This is the main class definition for the FreeBurn application,
- * including methods and program layout.
- *
- * Copyright (C) 2001, 2002 Adam Schlag
- */
- /*
- * FreeBurn Software License
- * (based on the Apache Software License)
- *
- * Version 1.1
- *
- * Copyright (c) 2001, 2002 The FreeBurn Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. 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.
- *
- * 3. The end-user documentation included with the redistribution, if any, must
- * include the following acknowledgment:
- *
- * "This product includes software developed by the FreeBurn
- * Project (http://freeburn.sourceforge.net/)."
- *
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "FreeBurn" and "FreeBurn Project" must not be
- * used to endorse or promote products derived from this software
- * without prior written permission. For written permission, please
- * contact aschlag@users.sourceforge.net.
- *
- * 5. Products derived from this software may not be called "FreeBurn",
- * nor may "FreeBurn" appear in their name, without prior written
- * permission of the FreeBurn Project.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED 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 FREEBURN PROJECT OR ITS
- * 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.
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the FreeBurn Project. For more
- * information on the FreeBurn Project and FreeBurn, please see
- * <http://freeburn.sourceforge.net/>.
- *
- * This software is distributed with software that is released under the GNU
- * General Public License (GPL). You can find the terms of this license in the
- * file GPL.txt distributed in this package. You can find information on the
- * software distributed with this package in the file PROGRAMS.txt.
- */
- // The main FOX include file, and the PNG Icon include file (it's not in fx.h)
- #include <fx.h>
- #include <FXPNGIcon.h>
- #include "fbspinner.h"
- #ifdef WIN32
- #include <windows.h>
- #endif
- // Application include files go here
- // the main freeburn definition class and additional
- // helper and gui classes go here
- #include "FreeburnDefs.h"
- #include "FreeburnText.h"
- #include "FreeburnHelpText.h"
- #ifndef FREEBURN_ICONS_H
- #include "FreeburnIcons.h"
- #define FREEBURN_ICONS_H
- #endif
- #include "FreeburnHelper.h"
- // these contain the classes for the disc and track layouts,
- // and their helper and utility methods
- #include "FreeburnTrack.h"
- #include "FreeburnDisc.h"
- // these contain the includes for the various dialog classes
- #include "FreeburnNewDiscDialog.h"
- #include "FreeburnBurnDiscDialog.h"
- #include "FreeburnDiscImageDialog.h"
- #include "FreeburnCommandDialog.h"
- #include "FreeburnPreferences.h"
- #include "FreeburnGlobalTextDialog.h"
- #include "FreeburnTrackDialog.h"
- #include "HelpWindow.h"
- #include "FreeburnAbout.h"
- // these contain the system-level process and threading classes
- #include "FreeburnSystem.h"
- // finally, the main freeburn include header
- #include "FreeBurn.h"
- // Message Map for FreeBurn class
- FXDEFMAP(CFreeBurn) CFreeBurnMap[]={
- //________Message_Type_______________ID_______________________Message_Handler___________
-
- // These are for the thread events to process the output of external commands
- FXMAPFUNC(SEL_IO_EXCEPT, CFreeBurn::ID_GET_THREAD_BUFFER, CFreeBurn::getThreadBuffer),
- FXMAPFUNC(SEL_IO_EXCEPT, CFreeBurn::ID_THREAD_COMPLETE, CFreeBurn::threadComplete),
-
- // These are for handling messages to change the application colors
- FXMAPFUNCS(SEL_COMMAND, CFreeBurn::ID_BASECOLOR,
- CFreeBurn::ID_BORDCOLOR, CFreeBurn::onCmdColor),
- FXMAPFUNCS(SEL_CHANGED, CFreeBurn::ID_BASECOLOR,
- CFreeBurn::ID_BORDCOLOR, CFreeBurn::onCmdColor),
- FXMAPFUNCS(SEL_UPDATE, CFreeBurn::ID_BASECOLOR,
- CFreeBurn::ID_BORDCOLOR, CFreeBurn::onUpdColor),
- FXMAPFUNCS(SEL_COMMAND, CFreeBurn::ID_BASECOLOR_DEFAULT,
- CFreeBurn::ID_BORDCOLOR_DEFAULT, CFreeBurn::onCmdColorDefault),
-
- // These are handling messages for commands, updates, etc. for the main program controls
- FXMAPFUNCS(SEL_UPDATE, CFreeBurn::ID_DISC_SIZE,
- CFreeBurn::ID_PERCENT_FULL, CFreeBurn::updMainControls),
- FXMAPFUNC(SEL_CHANGED, CFreeBurn::ID_CAT_NUM, CFreeBurn::updCatalogNum),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_USE_CD_TEXT, CFreeBurn::cmdUseCdText),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_EDIT_CD_TEXT, CFreeBurn::cmdEditCdText),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_ADD_TRACK, CFreeBurn::cmdAddTrack),
- FXMAPFUNCS(SEL_COMMAND, CFreeBurn::ID_AUDIO_TRACK,
- CFreeBurn::ID_XA_RAW_TRACK, CFreeBurn::cmdTrackType),
- FXMAPFUNCS(SEL_COMMAND, CFreeBurn::ID_EDIT_TRACK,
- CFreeBurn::ID_DELETE_TRACK, CFreeBurn::cmdModTrackCommand),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_MODIFY_TRACK, CFreeBurn::cmdModifyTrack),
-
- // These are handling messages to open the various dialogs and process basic toolbar/menu commands
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_NEW, CFreeBurn::newDiscLayout),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_OPEN, CFreeBurn::openDiscToc),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_SAVE, CFreeBurn::saveDiscToc),
- FXMAPFUNC(SEL_UPDATE, CFreeBurn::ID_SAVE, CFreeBurn::updSave),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_CLOSE, CFreeBurn::closeDiscLayout),
- FXMAPFUNC(SEL_UPDATE, CFreeBurn::ID_CLOSE, CFreeBurn::updClose),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_BURN_CD, CFreeBurn::burnDisc),
- FXMAPFUNC(SEL_UPDATE, CFreeBurn::ID_BURN_CD, CFreeBurn::updBurnDisc),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_CD_IMAGE, CFreeBurn::imageDisc),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_PREFERENCES, CFreeBurn::editPreferences),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_HELP, CFreeBurn::showHelp),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_HELP_CDRECORD, CFreeBurn::showHelpCdrecord),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_HELP_MKISOFS, CFreeBurn::showHelpMkisofs),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_HELP_CDRDAO, CFreeBurn::showHelpCdrdao),
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_ABOUT, CFreeBurn::aboutFreeburn),
-
- // these handle messages for the various ways the application can be terminated
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_EXIT, CFreeBurn::exitApp),
- FXMAPFUNC(SEL_SIGNAL, CFreeBurn::ID_EXIT, CFreeBurn::exitApp),
- FXMAPFUNC(SEL_CLOSE, CFreeBurn::ID_TITLE, CFreeBurn::exitApp),
-
- // these handle messages to get or set the values of various settings in the application
- FXMAPFUNC(SEL_COMMAND, CFreeBurn::ID_ICONTHEME, CFreeBurn::onCmdIconTheme),
- FXMAPFUNC(SEL_UPDATE, CFreeBurn::ID_ICONTHEME, CFreeBurn::onUpdIconTheme),
- };
- // Macro for the CFreeBurn class hierarchy implementation
- FXIMPLEMENT(CFreeBurn,FXMainWindow,CFreeBurnMap,ARRAYNUMBER(CFreeBurnMap))
- // Construct the application window
- CFreeBurn::CFreeBurn(FXApp *app):FXMainWindow(app,fbAppTitle,NULL,NULL,DECOR_ALL,FB_XPOS,FB_YPOS,FB_WIDTH,FB_HEIGHT,0,0)
- {
- // Setup any class variables
- readThemeSettings();
- m_programToExecute = TRACK_AT_ONCE;
- m_programToExecuteDataTarget.connect(m_programToExecute);
- m_discExists = FALSE;
- m_discSaved = TRUE;
- m_trackAddType = 0;
- m_modTrackCommand = 0;
-
- // set up the system process/threading class
- m_SystemClass = new CFreeburnSystem();
- m_ReadOutputHandle = m_SystemClass->getProcessEventHandle();
- m_ThreadCompleteHandle = m_SystemClass->getCompleteEventHandle();
-
- // setup mkisofs string (thanks microsoft...)
- FXString mkisofsString;
- mkisofsString.append(fbHelpMkisofsText);
- mkisofsString.append(fbHelpMkisofsText2);
-
- // set up the help windows
- m_HelpWindow = new HelpWindow(this, fbHelpText, fbHelpTitleText, FALSE);
- m_CdrecordHelpWindow = new HelpWindow(this, fbHelpCdrecordText, fbHelpCdrecordTitleText, TRUE);
- m_MkisofsHelpWindow = new HelpWindow(this, mkisofsString.text(), fbHelpMkisofsTitleText, TRUE);
- m_CdrdaoHelpWindow = new HelpWindow(this, fbHelpCdrdaoText, fbHelpCdrdaoTitleText, TRUE);
-
- // Load the icons for use
- loadThemeIcons();
- setThemeIcons();
- m_bigIcon = new FXPNGIcon(getApp(), fbicon_big_png);
- m_smallIcon = new FXPNGIcon(getApp(), fbicon_small_png);
-
- // Set the application icons
- setIcon(m_bigIcon);
- setMiniIcon(m_smallIcon);
- // Make main window; set myself as the target
- setTarget(this);
- setSelector(ID_TITLE);
- // Setup the m_menuBar
- FXToolbarShell* menuBarShell = new FXToolbarShell(this, FRAME_RAISED|FRAME_THICK);
- m_menuBar = new FXMenubar(this, menuBarShell, LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
- m_menuBarGrip = new FXToolbarGrip(m_menuBar, m_menuBar, FXMenubar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE);
-
- // populate the menubar with some menus
- setupProgramMenus();
- // Setup the m_toolBar
- FXToolbarShell* toolBarShell = new FXToolbarShell(this,FRAME_RAISED|FRAME_THICK);
- m_toolBar = new FXToolbar(this, toolBarShell,
- LAYOUT_SIDE_TOP|LAYOUT_FILL_X|PACK_UNIFORM_HEIGHT);
- m_toolBarGrip = new FXToolbarGrip(m_toolBar,m_toolBar,FXToolbar::ID_TOOLBARGRIP,TOOLBARGRIP_DOUBLE);
-
- // populate the toolbar with its buttons
- setupToolBar();
- // Setup the status bar
- m_statusBar = new FXStatusbar(this, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER);
- // Set up the main content frame and populate it with controls
- setupContentFrame();
-
- // Make a tool tip
- new FXTooltip(getApp(), 0);
- }
- // FreeBurn destructor
- CFreeBurn::~CFreeBurn()
- {
- // here we delete the widgets and other data that need to
- // be deleted explicitly, in a semi-logical order in the
- // reverse of the application's creation. The memory
- // allocated from the disc layout should already be closed
- // from the closeDisc method.
-
- delete m_HelpWindow;
- delete m_CdrecordHelpWindow;
- delete m_MkisofsHelpWindow;
- delete m_CdrdaoHelpWindow;
-
- delete m_DefaultNewIcon;
- delete m_DefaultOpenIcon;
- delete m_DefaultSaveIcon;
- delete m_DefaultCloseIcon;
- delete m_DefaultBurnCdIcon;
- delete m_DefaultCdImageIcon;
- delete m_DefaultPreferencesIcon;
- delete m_DefaultHelpIcon;
- delete m_DefaultExitIcon;
- delete m_DefaultThemePreviewIcon;
- delete m_DefaultFindIcon;
-
- delete m_GnomeNewIcon;
- delete m_GnomeOpenIcon;
- delete m_GnomeSaveIcon;
- delete m_GnomeCloseIcon;
- delete m_GnomeBurnCdIcon;
- delete m_GnomeCdImageIcon;
- delete m_GnomePreferencesIcon;
- delete m_GnomeHelpIcon;
- delete m_GnomeExitIcon;
- delete m_GnomeThemePreviewIcon;
- delete m_GnomeFindIcon;
-
- delete m_KdeNewIcon;
- delete m_KdeOpenIcon;
- delete m_KdeSaveIcon;
- delete m_KdeCloseIcon;
- delete m_KdeBurnCdIcon;
- delete m_KdeCdImageIcon;
- delete m_KdePreferencesIcon;
- delete m_KdeHelpIcon;
- delete m_KdeExitIcon;
- delete m_KdeThemePreviewIcon;
- delete m_KdeFindIcon;
-
- delete m_XpNewIcon;
- delete m_XpOpenIcon;
- delete m_XpSaveIcon;
- delete m_XpCloseIcon;
- delete m_XpBurnCdIcon;
- delete m_XpCdImageIcon;
- delete m_XpPreferencesIcon;
- delete m_XpHelpIcon;
- delete m_XpExitIcon;
- delete m_XpThemePreviewIcon;
- delete m_XpFindIcon;
-
- delete m_bigIcon;
- delete m_smallIcon;
-
- delete m_toolBar;
- delete m_fileMenu;
- delete m_optionsMenu;
- delete m_helpMenu;
- delete m_menuBar;
- }
- // Create and initialize
- void CFreeBurn::create(){
- // read the program settings from the registry
- readProgramSettings();
- // Create the windows
- FXMainWindow::create();
-
- // Make the main window appear
- show(PLACEMENT_VISIBLE);
- }
- // method to run to create a new disc layout in the program
- long CFreeBurn::newDiscLayout(FXObject*, FXSelector, void*)
- {
- // if the layout isn't saved, then ask if the user wants
- // to save the layout
- if (!m_discSaved)
- {
- if(!saveChanges()) return 1;
- }
-
- // close the current disc layout
- closeDisc();
-
- // initialize variables to hold the information about creating the disc
- FXint discSize = _74_650_DISC;
- FXint discType = CD_DA;
-
- // initialize data targets for the disc initialization variables
- FXDataTarget discSizeTarget;
- discSizeTarget.connect(discSize);
- FXDataTarget discTypeTarget;
- discTypeTarget.connect(discType);
-
- // Create an instance of the create disc dialog
- CFreeburnNewDiscDialog newDiscDialog(this, &discSizeTarget, &discTypeTarget);
-
- // run the dialog
- if (newDiscDialog.execute(PLACEMENT_OWNER))
- {
- // create the disc class if the dialog returns TRUE, and set
- // the discExists and discSaved flags to TRUE.
- m_mainDisc = new CFreeburnDisc(discSize, discType);
- m_discExists = TRUE;
- m_discSaved = FALSE;
-
- // set the track option menu
- switch(discType)
- {
- case CD_DA:
- m_trackOptions->setPopup(m_cddaPopup);
- // set the default track type for this disc type
- m_trackAddType = AUDIO;
- break;
- case CD_ROM:
- m_trackOptions->setPopup(m_cdromPopup);
- // set the default track type for this disc type
- m_trackAddType = MODE_1;
- break;
- case CDROM_XA:
- m_trackOptions->setPopup(m_cdxaPopup);
- // set the default track type for this disc type
- m_trackAddType = AUDIO;
- break;
- }
- }
-
- return 1;
- }
- // method to run to open a .toc file
- long CFreeBurn::openDiscToc(FXObject*, FXSelector, void*)
- {
- // if the layout isn't saved, then ask if the user wants
- // to save the layout
- if (!m_discSaved)
- {
- if(!saveChanges()) return 1;
- }
-
- FXMessageBox::information(this,MBOX_OK|PLACEMENT_CURSOR,"Open TOC",
- "Open TOC not yet fully implemented.");
-
- return 1;
- }
- // method to run to save a .toc file
- long CFreeBurn::saveDiscToc(FXObject*, FXSelector, void*)
- {
- FXMessageBox::information(this,MBOX_OK|PLACEMENT_CURSOR,"Save TOC",
- "Save TOC not yet fully implemented.");
-
- m_discSaved = TRUE;
-
- return 1;
- }
- // method to enable/disable the save buttons/commands if they are not needed
- long CFreeBurn::updSave(FXObject* sender, FXSelector, void* ptr)
- {
- FXuint msg = (m_discExists && !m_discSaved) ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE;
-
- sender->handle(this, MKUINT(msg,SEL_COMMAND), ptr);
-
- return 1;
- }
- // method to close the current disc layout
- long CFreeBurn::closeDiscLayout(FXObject*, FXSelector, void*)
- {
- // if the layout isn't saved, then ask if the user wants
- // to save the layout
- if (!m_discSaved)
- {
- if(!saveChanges()) return 1;
- }
-
- // close the current disc layout
- closeDisc();
-
- return 1;
- }
- // method to enable/disable the close commands if they are not needed
- long CFreeBurn::updClose(FXObject* sender, FXSelector, void* ptr)
- {
- FXuint msg = m_discExists ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE;
-
- sender->handle(this, MKUINT(msg,SEL_COMMAND), ptr);
-
- return 1;
- }
- // method to run when the burn disc command is executed
- long CFreeBurn::burnDisc(FXObject*, FXSelector, void*)
- {
- m_programToExecute = TRACK_AT_ONCE;
- m_useUnixShell = FALSE;
- m_commandLineOptions.clear();
-
- CFreeburnBurnDiscDialog burnDialog(this, &m_programToExecuteDataTarget);
-
- burnDialog.setHelpIcon(m_helpIcon);
- burnDialog.setCommandString(m_commandLineOptions);
- burnDialog.setShellFlag(m_useUnixShell);
-
- if (burnDialog.execute(PLACEMENT_OWNER))
- {
- m_commandLineOptions = burnDialog.getCommandString();
- m_useUnixShell = burnDialog.getShellFlag();
- runProgram();
- }
-
- return 1;
- }
- // method to enable/disable the burn disc command if they are not needed
- long CFreeBurn::updBurnDisc(FXObject* sender, FXSelector, void* ptr)
- {
- FXuint msg = m_discExists ? FXWindow::ID_ENABLE : FXWindow::ID_DISABLE;
-
- sender->handle(this, MKUINT(msg,SEL_COMMAND), ptr);
-
- return 1;
- }
- // method to run when the image disc command is executed
- long CFreeBurn::imageDisc(FXObject*, FXSelector, void*)
- {
- m_programToExecute = RUN_MKISOFS;
- m_useUnixShell = FALSE;
- m_commandLineOptions.clear();
-
- CFreeburnDiscImageDialog imageDialog(this);
-
- imageDialog.setHelpIcon(m_helpIcon);
- imageDialog.setCommandString(m_commandLineOptions);
- imageDialog.setShellFlag(m_useUnixShell);
-
- if (imageDialog.execute(PLACEMENT_OWNER))
- {
- m_commandLineOptions = imageDialog.getCommandString();
- m_useUnixShell = imageDialog.getShellFlag();
- runProgram();
- }
-
- return 1;
- }
- // method to run to execute an external program and set up the necessary
- // data and objects needed to start the program
- void CFreeBurn::runProgram()
- {
- // First, set up the command line string
- FXString programString;
- FXString commandString;
-
- // assign programString to the program the user wants
- // to execute (cdrecord, cdrdao, or mkisofs)
- switch(m_programToExecute)
- {
- case RUN_CDRECORD:
- programString = m_cdrecordPath;
- break;
- case RUN_CDRDAO:
- programString = m_cdrdaoPath;
- break;
- case RUN_MKISOFS:
- programString = m_mkisofsPath;
- break;
- }
-
- // make sure the program exists first...if not, show an error and exit
- // the method so we don't get errors running FreeBurn.
- if (!(FXFile::exists(programString)))
- {
- FXMessageBox::error(this,MBOX_OK|PLACEMENT_OWNER,fbCmdNotExistTitleText,
- fbCmdNotExistMessageText, FXFile::name(programString), programString);
-
- return;
- }
-
- if (m_useUnixShell) // set up the command to execute through the UNIX shell
- {
- // make sure that the unix shell program exists first...
- if (!(FXFile::exists(m_shellPath)))
- {
- FXMessageBox::error(this,MBOX_OK|PLACEMENT_OWNER,fbCmdNotExistTitleText,
- fbCmdNotExistMessageText, FXFile::name(m_shellPath), m_shellPath);
-
- return;
- }
- commandString = m_shellPath;
- FXString unixCommand;
- FreeburnHelper::winPathToUnixPath(programString, unixCommand);
- commandString.append(SHELL_COMMAND);
- commandString.append(QUOTE);
- commandString.append(unixCommand);
- commandString.append(SPACE);
- commandString.append(m_commandLineOptions);
- commandString.append(QUOTE);
- }
- else // set up the command to execute as it is
- {
- commandString = programString;
- commandString.append(SPACE);
- commandString.append(m_commandLineOptions);
- }
-
- // create the command dialog
- CFreeburnCommandDialog commandDialog(this);
- m_CommandDialog = &commandDialog;
-
- // set the save icon for the dialog
- commandDialog.setSaveIcon(m_SaveIcon);
-
- // set the text of the command to execute
- commandDialog.setCommandLabelText(commandString);
-
- // send the command out to run
- FXint returnValue; // returnValue is used to see if there is an error sending the command
- returnValue = m_SystemClass->createCommandWithPipes(commandString);
- // if the return value from createCommandWithPipes is anything but
- // 0, there is an error. The error number will give us a hint as to
- // where the error occured. This is the only place where we will use
- // a string that isn't from one of the [CLASSNAME]Text files, since
- // we are only using this for error purposes, and there probably won't
- // ever be an error
- if (returnValue != 0)
- {
- FXMessageBox::error(this,MBOX_OK|PLACEMENT_OWNER,fbCmdErrorTitleText,
- fbCmdErrorMessageText, returnValue);
- commandDialog.outputComplete();
- m_CommandDialog = NULL;
-
- return;
- }
- // execute the dialog to display the command output
- commandDialog.execute(PLACEMENT_OWNER);
-
- }
- // method to run when we receive a message from the thread that
- // is catching command output that it has a string for us to read
- long CFreeBurn::getThreadBuffer(FXObject*, FXSelector, void*)
- {
- FXString outputString;
-
- m_SystemClass->getStringText(outputString);
-
- m_CommandDialog->sendOutputText(outputString);
-
- return 1;
- }
- // method to run when we receive a message from the thread that
- // is catching command output that is is finished reading output
- long CFreeBurn::threadComplete(FXObject*, FXSelector, void*)
- {
- m_CommandDialog->outputComplete();
-
- m_CommandDialog = NULL;
-
- return 1;
- }
- // method to run when the properties command is executed
- long CFreeBurn::editPreferences(FXObject*, FXSelector, void*)
- {
- // setup local method variables so we can revert to the old
- // values in case the dialog is cancelled
- FXString tempShellPath = m_shellPath;
- FXString tempCdrecordPath = m_cdrecordPath;
- FXString tempMkisofsPath = m_mkisofsPath;
- FXString tempCdrdaoPath = m_cdrdaoPath;
- FXint tempThemeValue = m_theme;
- FXColor tempBaseColor = getBaseColor();
- FXColor tempBackColor = getBackgroundColor();
- FXColor tempForeColor = getForegroundColor();
- FXColor tempBordColor = getBorderColor();
-
- // show the prefs dialog
- CFreeburnPreferences prefsDialog(this, m_theme);
-
- // set the command line strings for the programs
- prefsDialog.setShellString(m_shellPath);
- prefsDialog.setCdrecordString(m_cdrecordPath);
- prefsDialog.setMkisofsString(m_mkisofsPath);
- prefsDialog.setCdrdaoString(m_cdrdaoPath);
-
- // set the icon to use for the find button
- prefsDialog.setFindIcon(m_FindIcon);
-
- // get the preview label from the prefs dialog
- m_PreviewLabel = prefsDialog.getPreviewLabel();
- // set the preview icon
- m_PreviewLabel->setIcon(m_ThemePreviewIcon);
-
- // if the dialog returns false (cancel), then set the path
- // strings and app colors back to what they were
- if (prefsDialog.execute(PLACEMENT_OWNER)) // change anything that is different
- {
- // get the program strings
- m_shellPath = prefsDialog.getShellString();
- m_cdrecordPath = prefsDialog.getCdrecordString();
- m_mkisofsPath = prefsDialog.getMkisofsString();
- m_cdrdaoPath = prefsDialog.getCdrdaoString();
-
- if (m_theme != tempThemeValue) // The icon theme is changed...
- {
- // change the theme icons for the toolbar buttons
- changeToolBarIcons();
-
- // change the theme icons for the menu panes
- changeMenuIcons();
- }
- }
- else // dialog was cancelled, so don't make any changes
- {
- m_shellPath = tempShellPath;
- m_cdrecordPath = tempCdrecordPath;
- m_mkisofsPath = tempMkisofsPath;
- m_cdrdaoPath = tempCdrdaoPath;
- m_theme = tempThemeValue;
- setBaseColor (tempBaseColor);
- setBackgroundColor(tempBackColor);
- setForegroundColor(tempForeColor);
- setBorderColor (tempBordColor);
- // revert the icons back to the proper theme
- setThemeIcons();
- }
-
- // the application (for some reason) gets sent back at times
- // when colors change, so let's raise the app back to the top
- raise();
-
- return 1;
- }
- // method to run when the help command is executed
- long CFreeBurn::showHelp(FXObject*, FXSelector, void*)
- {
- m_HelpWindow->execute(PLACEMENT_OWNER);
-
- return 1;
- }
- // method to run to show the cdrecord man page help window
- long CFreeBurn::showHelpCdrecord (FXObject*, FXSelector, void*)
- {
- m_CdrecordHelpWindow->execute(PLACEMENT_OWNER);
-
- return 1;
- }
- // method to run to show the mkisofs man page help window
- long CFreeBurn::showHelpMkisofs (FXObject*, FXSelector, void*)
- {
- m_MkisofsHelpWindow->execute(PLACEMENT_OWNER);
-
- return 1;
- }
- // method to run to show the cdrdao man page help window
- long CFreeBurn::showHelpCdrdao (FXObject*, FXSelector, void*)
- {
- m_CdrdaoHelpWindow->execute(PLACEMENT_OWNER);
-
- return 1;
- }
- // method to run when the exit command is executed
- long CFreeBurn::exitApp(FXObject*, FXSelector, void*)
- {
- // if the layout isn't saved, then ask if the user wants
- // to save the layout
- if (!m_discSaved)
- {
- if(!saveChanges()) return 1;
- }
-
- // save program settings to the registry
- writeProgramSettings();
-
- // exit the application
- getApp()->exit(0);
- return 1;
- }
- // method to run when about command is executed
- long CFreeBurn::aboutFreeburn (FXObject*, FXSelector, void*)
- {
- // show the about dialog
- CFreeburnAbout aboutDialog(this);
- aboutDialog.execute(PLACEMENT_OWNER);
-
- return 1;
- }
- // method to handle setting the theme value
- long CFreeBurn::onCmdIconTheme(FXObject* sender, FXSelector, void*)
- {
- FXint theme;
- sender->handle(this, MKUINT(ID_GETINTVALUE,SEL_COMMAND), (void*)&theme);
- m_theme = theme;
-
- // load the icons for the new theme
- setThemeIcons();
-
- // set the new preview icon
- m_PreviewLabel->setIcon(m_ThemePreviewIcon);
- return 1;
- }
- // method to handle getting the theme value
- long CFreeBurn::onUpdIconTheme(FXObject* sender, FXSelector, void*)
- {
- FXint theme = m_theme;
- sender->handle(this,MKUINT(ID_SETINTVALUE,SEL_COMMAND),(void*)&theme);
-
- return 1;
- }
- // method to handle updating the main window controls
- long CFreeBurn::updMainControls(FXObject*, FXSelector sel, void*)
- {
- FXString spaceString;
-
- // fisrt, determine if the disc exists or not
- if (m_discExists)
- {
- // the disc exists, so switch on the selector
- switch(SELID(sel))
- {
- case ID_DISC_SIZE:
- // disc exists, so set the text of the disc and make
- // sure the widget is enabled.
- m_sizeField->enable();
-
- // now, set the field to the specify the size
- // of the disc
- switch(m_mainDisc->discSizeType())
- {
- case _74_650_DISC:
- m_sizeField->setText(fb74650DiscText);
- break;
- case _80_700_DISC:
- m_sizeField->setText(fb80700DiscText);
- break;
- }
-
- break;
- case ID_DISC_TYPE:
- // disc exists, so set the text of the disc and make
- // sure the widget is enabled.
- m_typeField->enable();
-
- // now, set the field to the specify the size
- // of the disc
- switch(m_mainDisc->discType())
- {
- case CD_DA:
- m_typeField->setText(fbAudioDiscText);
- break;
- case CD_ROM:
- m_typeField->setText(fbCdRomDiscText);
- break;
- case CDROM_XA:
- m_typeField->setText(fbCdRomXaDiscText);
- break;
- }
-
- break;
- case ID_CAT_NUM:
- // disc exists, so set enable the widget
- m_catalogField->enable();
-
- break;
- case ID_USE_CD_TEXT:
- // disc exists, so set enable the widget
- m_cdTextButton->enable();
-
- break;
- case ID_EDIT_CD_TEXT:
- // now check if CD Text is enabled first.
- if (m_mainDisc->usingCdText())
- // CD Text is on, so set enable the widget
- m_editTextBut->enable();
- else
- // CD Text is disabled, so disable the edit
- // CD Text button
- m_editTextBut->disable();
-
- break;
- case ID_TRACK_TYPE:
- // check if the max track number is reached yet.
- if (m_mainDisc->trackCount() >= MAX_CD_TRACKS)
- m_trackOptions->disable();
- else
- m_trackOptions->enable();
-
- break;
- case ID_ADD_TRACK:
- // check if the max track number is reached yet.
- if (m_mainDisc->trackCount() >= MAX_CD_TRACKS)
- m_addTrackBut->disable();
- else
- m_addTrackBut->enable();
-
- break;
- case ID_MODIFY_TRACK_OPT:
- // also check if there are any tracks on the disc
- if (m_mainDisc->trackCount() >= 1)
- m_modTrackOpts->enable();
- else
- m_modTrackOpts->disable();
-
- break;
- case ID_TRACK_NUM:
- // enable if there are any tracks on the disc
- if (m_mainDisc->trackCount() >= 1)
- m_modTrackNum->enable();
- else
- m_modTrackNum->disable();
-
- break;
- case ID_MODIFY_TRACK:
- // enable if there are any tracks on the disc
- if (m_mainDisc->trackCount() >= 1)
- m_modTrackBut->enable();
- else
- m_modTrackBut->disable();
-
- break;
- case ID_USED_SPACE:
- // set the used space to the space (in blocks) used on the disc
- m_usedSpaceField->enable();
-
- spaceString.format("%d", m_mainDisc->discCurrentSize());
- m_usedSpaceField->setText(spaceString);
-
- break;
- case ID_FREE_SPACE:
- // set the free space to the space (in blocks) free on the disc
- m_freeSpaceField->enable();
-
- spaceString.format("%d", m_mainDisc->discFreeSpace());
- m_freeSpaceField->setText(spaceString);
-
- break;
- case ID_PERCENT_FULL:
- // update the percent full progress bar for the disc
- m_percentFull->enable();
- m_percentFull->setProgress(m_mainDisc->discCurrentSize() / (m_mainDisc->discCurrentSize() + m_mainDisc->discFreeSpace()));
-
- break;
- }
- }
- else
- {
- // the disc doesn't exist, switch on the selector
- switch(SELID(sel))
- {
- case ID_DISC_SIZE:
- // disable the size field, since there is no disc allocated.
- // also set the text to "" (Or empty) so the field is clear
- m_sizeField->setText(EMPTY_STRING);
- m_sizeField->disable();
-
- break;
- case ID_DISC_TYPE:
- // disable the size field, since there is no disc allocated.
- // also set the text to "" (Or empty) so the field is clear
- m_typeField->setText(EMPTY_STRING);
- m_typeField->disable();
-
- break;
- case ID_CAT_NUM:
- // disable the field, since there is no disc allocated.
- // also set the text to "" (Or empty) so the field is clear
- m_catalogField->setText(EMPTY_STRING);
- m_catalogField->disable();
-
- break;
- case ID_USE_CD_TEXT:
- // disable the field, since there is no disc allocated.
- // also set the text to "" (Or empty) so the field is clear
- m_cdTextButton->setCheck(FALSE);
- m_cdTextButton->disable();
-
- break;
- case ID_EDIT_CD_TEXT:
- // disable the field, since there is no disc allocated.
- // also set the text to "" (or empty) so the field is clear
- m_editTextBut->disable();
-
- break;
- case ID_TRACK_TYPE:
- // disable the track type option box
- m_trackOptions->disable();
-
- break;
- case ID_ADD_TRACK:
- // disable the add track button
- m_addTrackBut->disable();
-
- break;
- case ID_MODIFY_TRACK_OPT:
- // disable the modify track option box
- m_modTrackOpts->disable();
-
- break;
- case ID_TRACK_NUM:
- // disable the track number spinner
- m_modTrackNum->disable();
-
- break;
- case ID_MODIFY_TRACK:
- // disable the modify track button
- m_modTrackBut->disable();
-
- break;
- case ID_USED_SPACE:
- // disable the used space field
- m_usedSpaceField->setText(EMPTY_STRING);
- m_usedSpaceField->disable();
-
- break;
- case ID_FREE_SPACE:
- // disable the free space field
- m_freeSpaceField->setText(EMPTY_STRING);
- m_freeSpaceField->disable();
-
- break;
- case ID_PERCENT_FULL:
- // disable the percent full progress bar
- m_percentFull->setProgress(0);
- m_percentFull->disable();
-
- break;
- }
- }
-
- return 1;
- }
- // method to handle updating the catalog number control
- long CFreeBurn::updCatalogNum(FXObject*, FXSelector, void* ptr)
- {
- // The catalog number string has changed, so update the disc class
- // with the new catalog number.
- m_mainDisc->catalogNumber((FXchar *)ptr);
-
- return 1;
- }
- // method to update the use cd text flag
- long CFreeBurn::cmdUseCdText(FXObject*, FXSelector, void*)
- {
- // set the flag in the disc class for using cd text
- m_mainDisc->usingCdText(m_cdTextButton->getCheck());
-
- return 1;
- }
- // method to edit the global cd text
- long CFreeBurn::cmdEditCdText(FXObject*, FXSelector, void*)
- {
- // First, back up all the CD Text strings
- FXString titleString = m_mainDisc->discTitle();
- FXString performerString = m_mainDisc->discPerformer();
- FXString songwriterString = m_mainDisc->discSongWriter();
- FXString composerString = m_mainDisc->discComposer();
- FXString arrangerString = m_mainDisc->discArranger();
- FXString messageString = m_mainDisc->discMessage();
- FXString discidString = m_mainDisc->discId();
- FXString genreString = m_mainDisc->discGenre();
-
- // Now, create the dialog
- CFreeburnGlobalTextDialog globalTextDialog(this);
-
- // set the property strings in the dialog
- globalTextDialog.setTitleString(titleString);
- globalTextDialog.setPerformerString(performerString);
- globalTextDialog.setSongwriterString(songwriterString);
- globalTextDialog.setComposerString(composerString);
- globalTextDialog.setArrangerString(arrangerString);
- globalTextDialog.setMessageString(messageString);
- globalTextDialog.setDiscidString(discidString);
- globalTextDialog.setGenreString(genreString);
-
- // execute the dialog
- if (globalTextDialog.execute(PLACEMENT_OWNER))
- {
- m_mainDisc->discTitle(globalTextDialog.getTitleString());
- m_mainDisc->discPerformer(globalTextDialog.getPerformerString());
- m_mainDisc->discSongWriter(globalTextDialog.getSongwriterString());
- m_mainDisc->discComposer(globalTextDialog.getComposerString());
- m_mainDisc->discArranger(globalTextDialog.getArrangerString());
- m_mainDisc->discMessage(globalTextDialog.getMessageString());
- m_mainDisc->discId(globalTextDialog.getDiscidString());
- m_mainDisc->discGenre(globalTextDialog.getGenreString());
- }
- else
- {
- // dialog was cancelled, so revert the strings back to what they should be
- m_mainDisc->discTitle(titleString);
- m_mainDisc->discPerformer(performerString);
- m_mainDisc->discSongWriter(songwriterString);
- m_mainDisc->discComposer(composerString);
- m_mainDisc->discArranger(arrangerString);
- m_mainDisc->discMessage(messageString);
- m_mainDisc->discId(discidString);
- m_mainDisc->discGenre(genreString);
- }
-
- return 1;
- }
- // method to update the track type to add
- long CFreeBurn::cmdTrackType(FXObject*, FXSelector sel, void*)
- {
- // to set the track type, first determine what item is set
- // with a switch, then set to the appropriate type.
- switch(SELID(sel))
- {
- case ID_AUDIO_TRACK:
- m_trackAddType = AUDIO;
- break;
- case ID_DATA_TRACK:
- m_trackAddType = MODE_1;
- break;
- case ID_RAW_TRACK:
- m_trackAddType = MODE_1_RAW;
- break;
- case ID_XA_DATA_TRACK:
- m_trackAddType = MODE_2_FORM_1;
- break;
- case ID_XA_AUDIO_TRACK:
- m_trackAddType = MODE_2_FORM_2;
- break;
- case ID_XA_RAW_TRACK:
- m_trackAddType = MODE_2_RAW;
- break;
- }
-
- return 1;
- }
- // method to add a new track to the CD layout
- long CFreeBurn::cmdAddTrack(FXObject*, FXSelector, void*)
- {
- // create the new track
- m_mainDisc->createTrack(m_trackAddType);
-
- // set the new range for the spinner
- m_modTrackNum->setRange(MIN_CD_TRACKS, m_mainDisc->trackCount());
-
- // set the value in the spinner to the newly created track
- m_modTrackNum->setValue(m_mainDisc->trackCount());
-
- // create the track editor dialog
- CFreeburnTrackDialog trackDialog(this, m_mainDisc);
-
- // execute the dialog
- trackDialog.execute();
-
- return 1;
- }
- // method to change the command for modifying the track
- long CFreeBurn::cmdModTrackCommand(FXObject*, FXSelector sel, void*)
- {
- // to set the track type, first determine what item is set
- // with a switch, then set to the appropriate type.
- switch(SELID(sel))
- {
- case ID_EDIT_TRACK:
- m_modTrackCommand = EDIT_TRACK;
- break;
- case ID_DELETE_TRACK:
- m_modTrackCommand = DELETE_TRACK;
- break;
- }
-
- return 1;
- }
- // method to modify an existing track of the CD layout
- long CFreeBurn::cmdModifyTrack(FXObject*, FXSelector, void*)
- {
- if (m_modTrackCommand == EDIT_TRACK)
- {
- // set the active track number in the disc class to
- // the number the user has selected in the dialog
- m_mainDisc->setActiveTrack(m_modTrackNum->getValue());
-
- // create a track editor dialog, then execute it
- CFreeburnTrackDialog trackDialog(this, m_mainDisc);
- trackDialog.execute();
- }
- else if (m_modTrackCommand == DELETE_TRACK)
- {
- // ask the user if it indeed wants to delete the selected track
- FXuint answer = FXMessageBox::question(this, MBOX_YES_NO_CANCEL|PLACEMENT_CURSOR,
- fbDeleteTrackTitleText, fbDeleteTrackMessageText, m_modTrackNum->getValue());
-
- // if the answer is yes, try to delete the track
- if (answer == MBOX_CLICKED_YES)
- {
- // Delete the track. If it's successful, reset the track range.
- // If it's not, notify the user that the delete was unsuccessful.
- if (m_mainDisc->deleteTrack(m_modTrackNum->getValue()))
- {
- // set the new range for the spinner
- // if the track count is less than MIN_CD_TRACKS, set the range to 0..0
- if (m_mainDisc->trackCount() < MIN_CD_TRACKS)
- m_modTrackNum->setRange(0, 0);
- else
- m_modTrackNum->setRange(MIN_CD_TRACKS, m_mainDisc->trackCount());
- }
- else
- {
- FXMessageBox::error(this, MBOX_OK|PLACEMENT_CURSOR, fbDeleteTrackErrorTitleText,
- fbDeleteTrackErrorMessageText);
- }
- }
-
- }
-
- return 1;
- }
- // method to handle commands for changing the colors of the application
- long CFreeBurn::onCmdColor(FXObject*, FXSelector sel, void* ptr)
- {
- FXColor color = (FXColor)(long)ptr;
-
- // call the proper method based on what was actually selected
- // and give it the color to update to
- switch(SELID(sel))
- {
- case ID_BASECOLOR:
- setBaseColor(color);
- break;
- case ID_BACKCOLOR:
- setBackgroundColor(color);
- break;
- case ID_FORECOLOR:
- setForegroundColor(color);
- break;
- case ID_BORDCOLOR:
- setBorderColor(color);
- break;
- }
-
- return 1;
- }
- // Update colors
- long CFreeBurn::onUpdColor(FXObject* sender, FXSelector sel, void*)
- {
- FXColor color;
-
- // get the right color based on what we want to change
- switch(SELID(sel))
- {
- case ID_BASECOLOR:
- color = getBaseColor();
- break;
- case ID_BACKCOLOR:
- color = getBackgroundColor();
- break;
- case ID_FORECOLOR:
- color = getForegroundColor();
- break;
- case ID_BORDCOLOR:
- color = getBorderColor();
- break;
- }
-
- // send the color back to whoever asked for it
- sender->handle(this,MKUINT(ID_SETINTVALUE,SEL_COMMAND),(void*)&color);
-
- return 1;
- }
- // method to set the base color for the application (widget colors)
- void CFreeBurn::setBaseColor(FXColor color)
- {
- // Each setBackColor is followed by a setHiliteColor and
- // setShadowColor so that everything looks right. We'll
- // create variables for these colors so they only need
- // to be calculated once each time this method is called.
- FXColor hiliteColor = makeHiliteColor(color);
- FXColor shadowColor = makeShadowColor(color);
-
- // The colors of the widgets are changed in an order where
- // the stuff the user sees is changed first, so the change
- // is quicker(the toolbar, statusbar, etc. will be seen
- // before a menu pane). It may not make a difference, but
- // it may on a slower computer or sometime in the future, so
- // it doesn't hurt.
-
- // First, set the color of the menu bar
- m_menuBar->setBackColor(color);
- m_menuBar->setHiliteColor(hiliteColor);
- m_menuBar->setShadowColor(shadowColor);
-
- // Now set the color of the menu bar grip
- m_menuBarGrip->setBackColor(color);
- m_menuBarGrip->setHiliteColor(hiliteColor);
- m_menuBarGrip->setShadowColor(shadowColor);
-
- // Now, set the color for the menu titles
- // The regular back color AND the selected back
- // color need to be changed so it looks right when
- // selected and not selected.
- m_FileMenuTitle->setBackColor(color);
- m_FileMenuTitle->setSelBackColor(color);
- m_FileMenuTitle->setHiliteColor(hiliteColor);
- m_FileMenuTitle->setShadowColor(shadowColor);
-
- m_OptionsMenuTitle->setBackColor(color);
- m_OptionsMenuTitle->setSelBackColor(color);
- m_OptionsMenuTitle->setHiliteColor(hiliteColor);
- m_OptionsMenuTitle->setShadowColor(shadowColor);
-
- m_HelpMenuTitle->setBackColor(color);
- m_HelpMenuTitle->setSelBackColor(color);
- m_HelpMenuTitle->setHiliteColor(hiliteColor);
- m_HelpMenuTitle->setShadowColor(shadowColor);
-
- // The toolbar is next for color change
- m_toolBar->setBackColor(color);
- m_toolBar->setHiliteColor(hiliteColor);
- m_toolBar->setShadowColor(shadowColor);
-
- // Now set the color of the toolbar grip
- m_toolBarGrip->setBackColor(color);
- m_toolBarGrip->setHiliteColor(hiliteColor);
- m_toolBarGrip->setShadowColor(shadowColor);
-
- // Now do the toolbar buttons
- m_NewDiscButton->setBackColor(color);
- m_NewDiscButton->setHiliteColor(hiliteColor);
- m_NewDiscButton->setShadowColor(shadowColor);
-
- m_OpenDiscButton->setBackColor(color);
- m_OpenDiscButton->setHiliteColor(hiliteColor);
- m_OpenDiscButton->setShadowColor(shadowColor);
-
- m_SaveDiscButton->setBackColor(color);
- m_SaveDiscButton->setHiliteColor(hiliteColor);
- m_SaveDiscButton->setShadowColor(shadowColor);
-
- m_ToolSeparator1->setBackColor(color);
- m_ToolSeparator1->setHiliteColor(hiliteColor);
- m_ToolSeparator1->setShadowColor(shadowColor);
-
- m_BurnCdButton->setBackColor(color);
- m_BurnCdButton->setHiliteColor(hiliteColor);
- m_BurnCdButton->setShadowColor(shadowColor);
-
- m_CdImageButton->setBackColor(color);
- m_CdImageButton->setHiliteColor(hiliteColor);
- m_CdImageButton->setShadowColor(shadowColor);
-
- m_ToolSeparator2->setBackColor(color);
- m_ToolSeparator2->setHiliteColor(hiliteColor);
- m_ToolSeparator2->setShadowColor(shadowColor);
-
- m_PrefsButton->setBackColor(color);
- m_PrefsButton->setHiliteColor(hiliteColor);
- m_PrefsButton->setShadowColor(shadowColor);
-
- m_HelpButton->setBackColor(color);
- m_HelpButton->setHiliteColor(hiliteColor);
- m_HelpButton->setShadowColor(shadowColor);
-
- m_ToolSeparator3->setBackColor(color);
- m_ToolSeparator3->setHiliteColor(hiliteColor);
- m_ToolSeparator3->setShadowColor(shadowColor);
-
- m_ExitButton->setBackColor(color);
- m_ExitButton->setHiliteColor(hiliteColor);
- m_ExitButton->setShadowColor(shadowColor);
-
- // change the main content window
- m_contents->setBackColor(color);
- m_contents->setHiliteColor(hiliteColor);
- m_contents->setShadowColor(shadowColor);
-
- // change the status bar colors
- // we'll also have to change the status line
- // and drag corner elements of the status bar, too
- m_statusBar->setBackColor(color);
- m_statusBar->setHiliteColor(hiliteColor);
- m_statusBar->setShadowColor(shadowColor);
- m_statusBar->getStatusline()->setBackColor(color);
- m_statusBar->getStatusline()->setHiliteColor(hiliteColor);
- m_statusBar->getStatusline()->setShadowColor(shadowColor);
- m_statusBar->getDragCorner()->setBackColor(color);
- m_statusBar->getDragCorner()->setHiliteColor(hiliteColor);
- m_statusBar->getDragCorner()->setShadowColor(shadowColor);
-
- // Now we'll change the colors for the menu panes
- m_fileMenu->setBackColor(color);
- m_fileMenu->setHiliteColor(hiliteColor);
- m_fileMenu->setShadowColor(shadowColor);
-
- m_optionsMenu->setBackColor(color);
- m_optionsMenu->setHiliteColor(hiliteColor);
- m_optionsMenu->setShadowColor(shadowColor);
-
- m_helpMenu->setBackColor(color);
- m_helpMenu->setHiliteColor(hiliteColor);
- m_helpMenu->setShadowColor(shadowColor);
-
- // Next, set the colors for the menu commands
- // (menu separators are included with the commands)
- // First, the file menu commands
- m_NewMenuCommand->setBackColor(color);
- m_NewMenuCommand->setHiliteColor(hiliteColor);
- m_NewMenuCommand->setShadowColor(shadowColor);
-
- m_OpenMenuCommand->setBackColor(color);
- m_OpenMenuCommand->setHiliteColor(hiliteColor);
- m_OpenMenuCommand->setShadowColor(shadowColor);
-
- m_SaveMenuCommand->setBackColor(color);
- m_SaveMenuCommand->setHiliteColor(hiliteColor);
- m_SaveMenuCommand->setShadowColor(shadowColor);
-
- m_FileMenuSeparator->setHiliteColor(hiliteColor);
- m_FileMenuSeparator->setShadowColor(shadowColor);
-
- m_CloseMenuCommand->setBackColor(color);
- m_CloseMenuCommand->setHiliteColor(hiliteColor);
- m_CloseMenuCommand->setShadowColor(shadowColor);
-
- m_ExitMenuCommand->setBackColor(color);
- m_ExitMenuCommand->setHiliteColor(hiliteColor);
- m_ExitMenuCommand->setShadowColor(shadowColor);
- // Then, the options menu commands
- m_PrefsMenuCommand->setBackColor(color);
- m_PrefsMenuCommand->setHiliteColor(hiliteColor);
- m_PrefsMenuCommand->setShadowColor(shadowColor);
- // Now the help menu commands
- m_HelpMenuCommand->setBackColor(color);
- m_HelpMenuCommand->setHiliteColor(hiliteColor);
- m_HelpMenuCommand->setShadowColor(shadowColor);
-
- m_CdrecordHelpMenuCommand->setBackColor(color);
- m_CdrecordHelpMenuCommand->setHiliteColor(hiliteColor);
- m_CdrecordHelpMenuCommand->setShadowColor(shadowColor);
-
- m_MkisofsHelpMenuCommand->setBackColor(color);
- m_MkisofsHelpMenuCommand->setHiliteColor(hiliteColor);
- m_MkisofsHelpMenuCommand->setShadowColor(shadowColor);
-
- m_CdrdaoHelpMenuCommand->setBackColor(color);
- m_CdrdaoHelpMenuCommand->setHiliteColor(hiliteColor);
- m_CdrdaoHelpMenuCommand->setShadowColor(shadowColor);
-
- m_HelpMenuSeparator->setHiliteColor(hiliteColor);
- m_HelpMenuSeparator->setShadowColor(shadowColor);
-
- m_AboutMenuCommand->setBackColor(color);
- m_AboutMenuCommand->setHiliteColor(hiliteColor);
- m_AboutMenuCommand->setShadowColor(shadowColor);
-
- // set the colors for the main window controls
- setMainControlsBaseColor(color, hiliteColor, shadowColor);
-
- // set the colors for the already-created help windows
- m_HelpWindow->setWindowBaseColor(color, hiliteColor, shadowColor);
- m_CdrecordHelpWindow->setWindowBaseColor(color, hiliteColor, shadowColor);
- m_MkisofsHelpWindow->setWindowBaseColor(color, hiliteColor, shadowColor);
- m_CdrdaoHelpWindow->setWindowBaseColor(color, hiliteColor, shadowColor);
-
- // finally, after all the visible changes are made, change the
- // application base color (and hilite and shadow colors) so
- // everything is changed (i.e. in child dialogs)
- getApp()->setBaseColor(color);
- getApp()->setHiliteColor(hiliteColor);
- getApp()->setShadowColor(shadowColor);
- }
- // method for getting the current base color
- FXColor CFreeBurn::getBaseColor() const
- {
- return getApp()->getBaseColor();
- }
- // method for changing the background color for things
- // that use a background color (i.e. input widgets)
- // instead of a set base color.
- void CFreeBurn::setBackgroundColor(FXColor color)
- {
- // set the main window controls background colors
- setMainControlsBackgroundColor(color);
-
- // set the colors for the already-created help windows
- m_HelpWindow->setWindowBackColor(color);
- m_CdrecordHelpWindow->setWindowBackColor(color);
- m_MkisofsHelpWindow->setWindowBackColor(color);
- m_CdrdaoHelpWindow->setWindowBackColor(color);
-
- // after all the widgets are set, now set the
- // app back color
- getApp()->setBackColor(color);
- }
- // method for getting the current background color
- FXColor CFreeBurn::getBackgroundColor() const
- {
- return getApp()->getBackColor();
- }
- // method for changing the foreground color for
- // the widgets, including setting the text color
- // for most of the widgets
- void CFreeBurn::setForegroundColor(FXColor color)
- {
- // Now, set the color for the menu titles
- m_FileMenuTitle->setTextColor(color);
- m_FileMenuTitle->setSelTextColor(color);
-
- m_OptionsMenuTitle->setTextColor(color);
- m_OptionsMenuTitle->setSelTextColor(color);
-
- m_HelpMenuTitle->setTextColor(color);
- m_HelpMenuTitle->setSelTextColor(color);
-
- // Now do the toolbar buttons
- m_NewDiscButton->setTextColor(color);
-
- m_OpenDiscButton->setTextColor(color);
-
- m_SaveDiscButton->setTextColor(color);
-
- m_BurnCdButton->setTextColor(color);
-
- m_CdImageButton->setTextColor(color);
-
- m_PrefsButton->setTextColor(color);
-
- m_HelpButton->setTextColor(color);
-
- m_ExitButton->setTextColor(color);
-
- // change the status bar colors
- m_statusBar->getStatusline()->setTextColor(color);
-
- // Next, set the colors for the menu commands
- // (menu separators are included with the commands)
- // First, the file menu commands
- m_NewMenuCommand->setTextColor(color);
- m_OpenMenuCommand->setTextColor(color);
- m_SaveMenuCommand->setTextColor(color);
- m_CloseMenuCommand->setTextColor(color);
- m_ExitMenuCommand->setTextColor(color);
- // Then, the options menu commands
- m_PrefsMenuCommand->setTextColor(color);
- // Now the help menu commands
- m_HelpMenuCommand->setTextColor(color);
- m_CdrecordHelpMenuCommand->setTextColor(color);
- m_MkisofsHelpMenuCommand->setTextColor(color);
- m_CdrdaoHelpMenuCommand->setTextColor(color);
- m_AboutMenuCommand->setTextColor(color);
-
- // set the main window controls foreground colors
- setMainControlsForegroundColor(color);
-
- // set the colors for the already-created help windows
- m_HelpWindow->setWindowForeColor(color);
- m_CdrecordHelpWindow->setWindowForeColor(color);
- m_MkisofsHelpWindow->setWindowForeColor(color);
- m_CdrdaoHelpWindow->setWindowForeColor(color);
-
- // finally, after all the visible changes are made, change the
- // application foreground color
- getApp()->setForeColor(color);
- }
- FXColor CFreeBurn::getForegroundColor() const
- {
- return getApp()->getForeColor();
- }
- void CFreeBurn::setBorderColor(FXColor color)
- {
- // menubar first
- m_menuBar->setBorderColor(color);
-
- // change the toolbar
- m_toolBar->setBorderColor(color);
-
- // now the toolbar buttons
- m_NewDiscButton->setBorderColor(color);
- m_OpenDiscButton->setBorderColor(color);
- m_SaveDiscButton->setBorderColor(color);
- m_BurnCdButton->setBorderColor(color);
- m_CdImageButton->setBorderColor(color);
- m_PrefsButton->setBorderColor(color);
- m_HelpButton->setBorderColor(color);
- m_ExitButton->setBorderColor(color);
-
- // next the content frame
- m_contents->setBorderColor(color);
- // now the status bar (and status line)
- m_statusBar->setBorderColor(color);
- m_statusBar->getStatusline()->setBorderColor(color);
- // then the menu panes
- m_fileMenu->setBorderColor(color);
- m_optionsMenu->setBorderColor(color);
- m_helpMenu->setBorderColor(color);
-
- // set the main window controls background colors
- setMainControlsBorderColor(color);
-
- // set the colors for the already-created help windows
- m_HelpWindow->setWindowBordColor(color);
- m_CdrecordHelpWindow->setWindowBordColor(color);
- m_MkisofsHelpWindow->setWindowBordColor(color);
- m_CdrdaoHelpWindow->setWindowBordColor(color);
-
- // finally, set the application value
- getApp()->setBorderColor(color);
- }
- FXColor CFreeBurn::getBorderColor() const
- {
- return getApp()->getBorderColor();
- }
- // method to handle commands for changing the colors of the application
- long CFreeBurn::onCmdColorDefault(FXObject*, FXSelector sel, void*)
- {
- switch(SELID(sel))
- {
- case ID_BASECOLOR_DEFAULT:
- setDefaultBaseColor();
- break;
- case ID_BACKCOLOR_DEFAULT:
- setDefaultBackgroundColor();
- break;
- case ID_FORECOLOR_DEFAULT:
- setDefaultForegroundColor();
- break;
- case ID_BORDCOLOR_DEFAULT:
- setDefaultBorderColor();
- break;
- }
-
- return 1;
- }
- // method to set the default base color
- void CFreeBurn::setDefaultBaseColor()
- {
- FXColor baseColor;
-
- #ifndef WIN32
- baseColor = FXRGB(192,192,192);
- #else
- DWORD dwColor;
- dwColor = GetSysColor(COLOR_3DFACE);
- baseColor = FXRGB(GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor));
-
- #endif
- setBaseColor(baseColor);
- }
- // method to set the default background color
- void CFreeBurn::setDefaultBackgroundColor()
- {
- FXColor backColor;
-
- #ifndef WIN32
- backColor = FXRGB(255,255,255);
- #else
- DWORD dwColor;
- dwColor = GetSysColor(COLOR_WINDOW);
- backColor = FXRGB(GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor));
-
- #endif
- setBackgroundColor(backColor);
- }
- // method to set the default foreground color
- void CFreeBurn::setDefaultForegroundColor()
- {
- FXColor foreColor;
-
- #ifndef WIN32
- foreColor = FXRGB(0,0,0);
- #else
- DWORD dwColor;
- dwColor = GetSysColor(COLOR_BTNTEXT);
- foreColor = FXRGB(GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor));
-
- #endif
- setForegroundColor(foreColor);
- }
- // method to set the default border color
- void CFreeBurn::setDefaultBorderColor()
- {
- FXColor borderColor;
-
- #ifndef WIN32
- borderColor = FXRGB(0,0,0);
- #else
- DWORD dwColor;
- dwColor = GetSysColor(COLOR_WINDOWFRAME);
- borderColor = FXRGB(GetRValue(dwColor),GetGValue(dwColor),GetBValue(dwColor));
-
- #endif
- setBorderColor(borderColor);
- }
- // Load the proper icons for the program based on the configured theme
- void CFreeBurn::loadThemeIcons()
- {
- // first, load all the icons for all the themes so we have them to use...
- m_DefaultNewIcon = new FXPNGIcon(getApp(), w_new_png);
- m_DefaultOpenIcon = new FXPNGIcon(getApp(), w_open_png);
- m_DefaultSaveIcon = new FXPNGIcon(getApp(), w_save_png);
- m_DefaultCloseIcon = new FXPNGIcon(getApp(), w_close_png);
- m_DefaultBurnCdIcon = new FXPNGIcon(getApp(), w_burncd_png);
- m_DefaultCdImageIcon = new FXPNGIcon(getApp(), w_cdimage_png);
- m_DefaultPreferencesIcon = new FXPNGIcon(getApp(), w_preferences_png);
- m_DefaultHelpIcon = new FXPNGIcon(getApp(), w_help_png);
- m_DefaultExitIcon = new FXPNGIcon(getApp(), w_exit_png);
- m_DefaultThemePreviewIcon = new FXPNGIcon(getApp(), w_theme_preview_png);
- m_DefaultFindIcon = new FXPNGIcon(getApp(), w_find_png);
-
- m_GnomeNewIcon = new FXPNGIcon(getApp(), g_new_png);
- m_GnomeOpenIcon = new FXPNGIcon(getApp(), g_open_png);
- m_GnomeSaveIcon = new FXPNGIcon(getApp(), g_save_png);
- m_GnomeCloseIcon = new FXPNGIcon(getApp(), g_close_png);
- m_GnomeBurnCdIcon = new FXPNGIcon(getApp(), g_burncd_png);
- m_GnomeCdImageIcon = new FXPNGIcon(getApp(), g_cdimage_png);
- m_GnomePreferencesIcon = new FXPNGIcon(getApp(), g_preferences_png);
- m_GnomeHelpIcon = new FXPNGIcon(getApp(), g_help_png);
- m_GnomeExitIcon = new FXPNGIcon(getApp(), g_exit_png);
- m_GnomeThemePreviewIcon = new FXPNGIcon(getApp(), g_theme_preview_png);
- m_GnomeFindIcon = new FXPNGIcon(getApp(), g_find_png);
-
- m_KdeNewIcon = new FXPNGIcon(getApp(), k_new_png);
- m_KdeOpenIcon = new FXPNGIcon(getApp(), k_open_png);
- m_KdeSaveIcon = new FXPNGIcon(getApp(), k_save_png);
- m_KdeCloseIcon = new FXPNGIcon(getApp(), k_close_png);
- m_KdeBurnCdIcon = new FXPNGIcon(getApp(), k_burncd_png);
- m_KdeCdImageIcon = new FXPNGIcon(getApp(), k_cdimage_png);
- m_KdePreferencesIcon = new FXPNGIcon(getApp(), k_preferences_png);
- m_KdeHelpIcon = new FXPNGIcon(getApp(), k_help_png);
- m_KdeExitIcon = new FXPNGIcon(getApp(), k_exit_png);
- m_KdeThemePreviewIcon = new FXPNGIcon(getApp(), k_theme_preview_png);
- m_KdeFindIcon = new FXPNGIcon(getApp(), k_find_png);
-
- m_XpNewIcon = new FXPNGIcon(getApp(), xp_new_png);
- m_XpOpenIcon = new FXPNGIcon(getApp(), xp_open_png);
- m_XpSaveIcon = new FXPNGIcon(getApp(), xp_save_png);
- m_XpCloseIcon = new FXPNGIcon(getApp(), xp_close_png);
- m_XpBurnCdIcon = new FXPNGIcon(getApp(), xp_burncd_png);
- m_XpCdImageIcon = new FXPNGIcon(getApp(), xp_cdimage_png);
- m_XpPreferencesIcon = new FXPNGIcon(getApp(), xp_preferences_png);
- m_XpHelpIcon = new FXPNGIcon(getApp(), xp_help_png);
- m_XpExitIcon = new FXPNGIcon(getApp(), xp_exit_png);
- m_XpThemePreviewIcon = new FXPNGIcon(getApp(), xp_theme_preview_png);
- m_XpFindIcon = new FXPNGIcon(getApp(), xp_find_png);
-
- // create all the icons for use...
- m_DefaultNewIcon->create();
- m_DefaultOpenIcon->create();
- m_DefaultSaveIcon->create();
- m_DefaultCloseIcon->create();
- m_DefaultBurnCdIcon->create();
- m_DefaultCdImageIcon->create();
- m_DefaultPreferencesIcon->create();
- m_DefaultHelpIcon->create();
- m_DefaultExitIcon->create();
- m_DefaultThemePreviewIcon->create();
- m_DefaultFindIcon->create();
-
- m_GnomeNewIcon->create();
- m_GnomeOpenIcon->create();
- m_GnomeSaveIcon->create();
- m_GnomeCloseIcon->create();
- m_GnomeBurnCdIcon->create();
- m_GnomeCdImageIcon->create();
- m_GnomePreferencesIcon->create();
- m_GnomeHelpIcon->create();
- m_GnomeExitIcon->create();
- m_GnomeThemePreviewIcon->create();
- m_GnomeFindIcon->create();
- m_KdeNewIcon->create();
- m_KdeOpenIcon->create();
- m_KdeSaveIcon->create();
- m_KdeCloseIcon->create();
- m_KdeBurnCdIcon->create();
- m_KdeCdImageIcon->create();
- m_KdePreferencesIcon->create();
- m_KdeHelpIcon->create();
- m_KdeExitIcon->create();
- m_KdeThemePreviewIcon->create();
- m_KdeFindIcon->create();
-
- m_XpNewIcon->create();
- m_XpOpenIcon->create();
- m_XpSaveIcon->create();
- m_XpCloseIcon->create();
- m_XpBurnCdIcon->create();
- m_XpCdImageIcon->create();
- m_XpPreferencesIcon->create();
- m_XpHelpIcon->create();
- m_XpExitIcon->create();
- m_XpThemePreviewIcon->create();
- m_XpFindIcon->create();
- }
- // set the proper icons for the program based on the configured theme
- void CFreeBurn::setThemeIcons()
- {
- // set the default icons based on the current theme...
- if (m_theme == GNOME_THEME) // GNOME theme
- {
- m_NewIcon = m_GnomeNewIcon;
- m_OpenIcon = m_GnomeOpenIcon;
- m_SaveIcon = m_GnomeSaveIcon;
- m_CloseIcon = m_GnomeCloseIcon;
- m_burnCdIcon = m_GnomeBurnCdIcon;
- m_cdImageIcon = m_GnomeCdImageIcon;
- m_preferencesIcon = m_GnomePreferencesIcon;
- m_helpIcon = m_GnomeHelpIcon;
- m_exitIcon = m_GnomeExitIcon;
- m_ThemePreviewIcon = m_GnomeThemePreviewIcon;
- m_FindIcon = m_GnomeFindIcon;
- }
- else if (m_theme == KDE_THEME) // KDE theme
- {
- m_NewIcon = m_KdeNewIcon;
- m_OpenIcon = m_KdeOpenIcon;
- m_SaveIcon = m_KdeSaveIcon;
- m_CloseIcon = m_KdeCloseIcon;
- m_burnCdIcon = m_KdeBurnCdIcon;
- m_cdImageIcon = m_KdeCdImageIcon;
- m_preferencesIcon = m_KdePreferencesIcon;
- m_helpIcon = m_KdeHelpIcon;
- m_exitIcon = m_KdeExitIcon;
- m_ThemePreviewIcon = m_KdeThemePreviewIcon;
- m_FindIcon = m_KdeFindIcon;
- }
- else if (m_theme == XP_THEME) // XP theme
- {
- m_NewIcon = m_XpNewIcon;
- m_OpenIcon = m_XpOpenIcon;
- m_SaveIcon = m_XpSaveIcon;
- m_CloseIcon = m_XpCloseIcon;
- m_burnCdIcon = m_XpBurnCdIcon;
- m_cdImageIcon = m_XpCdImageIcon;
- m_preferencesIcon = m_XpPreferencesIcon;
- m_helpIcon = m_XpHelpIcon;
- m_exitIcon = m_XpExitIcon;
- m_ThemePreviewIcon = m_XpThemePreviewIcon;
- m_FindIcon = m_XpFindIcon;
- }
- else // use default theme if no valid theme is given
- {
- m_NewIcon = m_DefaultNewIcon;
- m_OpenIcon = m_DefaultOpenIcon;
- m_SaveIcon = m_DefaultSaveIcon;
- m_CloseIcon = m_DefaultCloseIcon;
- m_burnCdIcon = m_DefaultBurnCdIcon;
- m_cdImageIcon = m_DefaultCdImageIcon;
- m_preferencesIcon = m_DefaultPreferencesIcon;
- m_helpIcon = m_DefaultHelpIcon;
- m_exitIcon = m_DefaultExitIcon;
- m_ThemePreviewIcon = m_DefaultThemePreviewIcon;
- m_FindIcon = m_DefaultFindIcon;
- }
- }
- // setup the program toolbar with buttons and stuff
- void CFreeBurn::setupToolBar()
- {
- // setup and add the m_toolBar buttons
- m_NewDiscButton = new FXButton(m_toolBar, fbNewButtonText, m_NewIcon,
- this, ID_NEW, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
- m_OpenDiscButton = new FXButton(m_toolBar, fbOpenButtonText, m_OpenIcon,
- this, ID_OPEN, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
- m_SaveDiscButton = new FXButton(m_toolBar, fbSaveButtonText, m_SaveIcon,
- this, ID_SAVE, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
- m_ToolSeparator1 = new FXVerticalSeparator(m_toolBar);
- m_BurnCdButton = new FXButton(m_toolBar, fbBurnCDButtonText, m_burnCdIcon,
- this, ID_BURN_CD, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
- m_CdImageButton = new FXButton(m_toolBar, fbCDImageButtonText, m_cdImageIcon,
- this, ID_CD_IMAGE, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
- m_ToolSeparator2 = new FXVerticalSeparator(m_toolBar);
- m_PrefsButton = new FXButton(m_toolBar, fbPropertiesButtonText, m_preferencesIcon,
- this, ID_PREFERENCES, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
- m_HelpButton = new FXButton(m_toolBar, fbHelpButtonText, m_helpIcon,
- this, ID_HELP, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
- m_ToolSeparator3 = new FXVerticalSeparator(m_toolBar);
- m_ExitButton = new FXButton(m_toolBar, fbExitButtonText, m_exitIcon,
- this, ID_EXIT, BUTTON_TOOLBAR|FRAME_RAISED|LAYOUT_TOP|LAYOUT_LEFT);
-
- }
- // change the icons for the buttons in the toolbar
- void CFreeBurn::changeToolBarIcons()
- {
- m_NewDiscButton->setIcon(m_NewIcon);
- m_OpenDiscButton->setIcon(m_OpenIcon);
- m_SaveDiscButton->setIcon(m_SaveIcon);
- m_BurnCdButton->setIcon(m_burnCdIcon);
- m_CdImageButton->setIcon(m_cdImageIcon);
- m_PrefsButton->setIcon(m_preferencesIcon);
- m_HelpButton->setIcon(m_helpIcon);
- m_ExitButton->setIcon(m_exitIcon);
- }
- // setup all the program menus
- void CFreeBurn::setupProgramMenus()
- {
- // Construct menu panes and add
- // them to the m_menuBar
- m_fileMenu = new FXMenuPane(this);
- m_FileMenuTitle = new FXMenuTitle(m_menuBar, fbFileMenuTitle, NULL, m_fileMenu);
-
- m_optionsMenu = new FXMenuPane(this);
- m_OptionsMenuTitle = new FXMenuTitle(m_menuBar, fbOptionsMenuTitle, NULL, m_optionsMenu);
-
- m_helpMenu = new FXMenuPane(this);
- m_HelpMenuTitle = new FXMenuTitle(m_menuBar, fbHelpMenuTitle, NULL, m_helpMenu);
-
- // setup and add the file menu commands
- m_NewMenuCommand = new FXMenuCommand(m_fileMenu, fbFileMenuNewText, m_NewIcon, this, ID_NEW);
- m_OpenMenuCommand = new FXMenuCommand(m_fileMenu, fbFileMenuOpenText, m_OpenIcon, this, ID_OPEN);
- m_SaveMenuCommand = new FXMenuCommand(m_fileMenu, fbFileMenuSaveText, m_SaveIcon, this, ID_SAVE);
- m_FileMenuSeparator = new FXMenuSeparator(m_fileMenu);
- m_CloseMenuCommand = new FXMenuCommand(m_fileMenu, fbFileMenuCloseText, m_CloseIcon, this, ID_CLOSE);
- m_ExitMenuCommand = new FXMenuCommand(m_fileMenu, fbFileMenuQuitText, m_exitIcon, this, ID_EXIT);
-
- // setup and add the options menu commands
- m_PrefsMenuCommand = new FXMenuCommand(m_optionsMenu, fbOptionsMenuPropertiesText,
- m_preferencesIcon, this, ID_PREFERENCES);
-
- // setup and add the help menu commands
- m_HelpMenuCommand = new FXMenuCommand(m_helpMenu, fbHelpMenuHelpText,
- m_helpIcon, this, ID_HELP);
- m_CdrecordHelpMenuCommand = new FXMenuCommand(m_helpMenu, fbHelpMenuCdrecordText,
- m_helpIcon, this, ID_HELP_CDRECORD);
- m_MkisofsHelpMenuCommand = new FXMenuCommand(m_helpMenu, fbHelpMenuMkisofsText,
- m_helpIcon, this, ID_HELP_MKISOFS);
- m_CdrdaoHelpMenuCommand = new FXMenuCommand(m_helpMenu, fbHelpMenuCdrdaoText,
- m_helpIcon, this, ID_HELP_CDRDAO);
- m_HelpMenuSeparator = new FXMenuSeparator(m_helpMenu);
- m_AboutMenuCommand = new FXMenuCommand(m_helpMenu, fbHelpMenuAboutText,
- m_smallIcon, this, ID_ABOUT);
- }
- // change the icons for all the menu commands
- void CFreeBurn::changeMenuIcons()
- {
- // the File menu commands...
- m_NewMenuCommand->setIcon(m_NewIcon);
- m_OpenMenuCommand->setIcon(m_OpenIcon);
- m_SaveMenuCommand->setIcon(m_SaveIcon);
- m_CloseMenuCommand->setIcon(m_CloseIcon);
- m_ExitMenuCommand->setIcon(m_exitIcon);
- // then the Options menu commands...
- m_PrefsMenuCommand->setIcon(m_preferencesIcon);
- // finally the Help menu commands (About doesn't change)
- m_HelpMenuCommand->setIcon(m_helpIcon);
- m_CdrecordHelpMenuCommand->setIcon(m_helpIcon);
- m_MkisofsHelpMenuCommand->setIcon(m_helpIcon);
- m_CdrdaoHelpMenuCommand->setIcon(m_helpIcon);
- }
- // set up the main content window controls
- void CFreeBurn::setupContentFrame()
- {
- m_contents = new FXVerticalFrame(this, FRAME_SUNKEN|FRAME_THICK|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y,
- 0, 0, 0, 0, 15, 15, 15, 15);
-
- m_mainFrame = new FXVerticalFrame(m_contents, LAYOUT_CENTER_X|LAYOUT_CENTER_Y);
-
- m_Group1 = new FXGroupBox(m_mainFrame, fbDiscConfigBoxText, GROUPBOX_NORMAL|FRAME_LINE);
- // matrix to hold all the window controls in a nice looking layout
- m_contentMatrix = new FXMatrix(m_Group1, 4, MATRIX_BY_COLUMNS|PACK_UNIFORM_HEIGHT,
- 0, 0, 0, 0, 0, 0, 0, 0, 5, 15);
-
- // row 1
- m_DiscSizeLabel = new FXLabel(m_contentMatrix, fbDiscSizeLabelText, NULL, JUSTIFY_RIGHT|LAYOUT_FILL_X);
- m_sizeField = new FXTextField(m_contentMatrix, 20, this, ID_DISC_SIZE,
- TEXTFIELD_READONLY|FRAME_SUNKEN|FRAME_THICK);
- m_DiscTypeLabel = new FXLabel(m_contentMatrix, fbDiscTypeLabelText, NULL, JUSTIFY_RIGHT|LAYOUT_FILL_X);
- m_typeField = new FXTextField(m_contentMatrix, 20, this, ID_DISC_TYPE,
- TEXTFIELD_READONLY|FRAME_SUNKEN|FRAME_THICK);
-
- // row 2
- m_catalogLabel = new FXLabel(m_contentMatrix, fbCatNumLabelText, NULL, JUSTIFY_RIGHT);
- m_catalogField = new FXTextField(m_contentMatrix, CD_CATALOG_STRING_LENGTH, this, ID_CAT_NUM,
- TEXTFIELD_LIMITED|FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X);
- m_cdTextButton = new FXCheckButton(m_contentMatrix, fbCdTextLabelText, this, ID_USE_CD_TEXT,
- ICON_BEFORE_TEXT);
- m_editTextBut = new FXButton(m_contentMatrix, fbEditGlobalCdTextButtonText, NULL, this, ID_EDIT_CD_TEXT,
- FRAME_RAISED|FRAME_THICK|LAYOUT_FILL_X);
-
- m_Group2 = new FXGroupBox(m_mainFrame, fbTrackFuncsBoxText, GROUPBOX_NORMAL|FRAME_LINE|LAYOUT_FILL_X);
-
- m_secondMatrix = new FXMatrix(m_Group2, 4, MATRIX_BY_COLUMNS|PACK_UNIFORM_HEIGHT|LAYOUT_CENTER_X);
-
- // row 3
- m_addTrackLabel = new FXLabel(m_secondMatrix, fbAddCdTrackLabelText, NULL, JUSTIFY_CENTER_X|LAYOUT_FILL_X);
- m_trackOptions = new FXOptionMenu(m_secondMatrix, NULL,
- FRAME_RAISED|FRAME_THICK|JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_trackOptions->setTarget(this);
- m_trackOptions->setSelector(ID_TRACK_TYPE);
- m_trackLabel1 = new FXLabel(m_secondMatrix, fbTrackLabel1Text, NULL);
- m_addTrackBut = new FXButton(m_secondMatrix, fbAddTrackButtonText, NULL, this, ID_ADD_TRACK,
- FRAME_RAISED|FRAME_THICK);
-
- // row 4
- m_modTrackPopup = new FXPopup(this);
- m_editTrack = new FXOption(m_modTrackPopup, fbEditTrackOptionText, NULL, this,
- ID_EDIT_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_deleteTrack = new FXOption(m_modTrackPopup, fbDeleteTrackOptionText, NULL, this,
- ID_DELETE_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_modTrackOpts = new FXOptionMenu(m_secondMatrix, NULL,
- LAYOUT_TOP|FRAME_RAISED|FRAME_THICK|JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_modTrackOpts->setTarget(this);
- m_modTrackOpts->setSelector(ID_MODIFY_TRACK_OPT);
- m_modTrackOpts->setPopup(m_modTrackPopup);
- m_modTrackLabel = new FXLabel(m_secondMatrix, fbModTrackLabelText, NULL, JUSTIFY_CENTER_X|LAYOUT_FILL_X);
- m_modTrackNum = new FBSpinner(m_secondMatrix, 2, this, ID_TRACK_NUM, SPIN_NORMAL|FRAME_SUNKEN|FRAME_THICK);
- // set the initial range of the spinner to 0..0
- m_modTrackNum->setRange(0, 0);
- // set the help text for the spinner
- m_modTrackNum->setHelpText(fbTrackNumberHelpText);
- m_modTrackBut = new FXButton(m_secondMatrix, fbModTrackButtonText, NULL, this, ID_MODIFY_TRACK,
- FRAME_RAISED|FRAME_THICK);
-
- // The popup for audio tracks
- m_cddaPopup = new FXPopup(this);
- m_cddaAudio = new FXOption(m_cddaPopup, fbAudioTrackOptionText, NULL, this,
- ID_AUDIO_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_trackOptions->setPopup(m_cddaPopup);
-
- // The popup for data tracks
- m_cdromPopup = new FXPopup(this);
- m_cdromData = new FXOption(m_cdromPopup, fbDataTrackOptionText, NULL, this,
- ID_DATA_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_cdromAudio = new FXOption(m_cdromPopup, fbAudioTrackOptionText, NULL, this,
- ID_AUDIO_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_cdromRaw = new FXOption(m_cdromPopup, fbRawDataTrackOptionText, NULL, this,
- ID_RAW_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
-
- // The popup for XA tracks
- m_cdxaPopup = new FXPopup(this);
- m_cdxaAudio = new FXOption(m_cdxaPopup, fbAudioTrackOptionText, NULL, this,
- ID_AUDIO_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_cdxaData = new FXOption(m_cdxaPopup, fbMode2DataTrackOptionText, NULL, this,
- ID_XA_DATA_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_cdxaAudio2 = new FXOption(m_cdxaPopup, fbMode2AudioTrackOptionText, NULL, this,
- ID_XA_AUDIO_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
- m_cdxaRaw = new FXOption(m_cdxaPopup, fbMode2RawTrackOptionText, NULL, this,
- ID_XA_RAW_TRACK, JUSTIFY_HZ_APART|ICON_AFTER_TEXT);
-
- // The bottom area for reporting disc used and free space
- m_spaceFrame = new FXHorizontalFrame(m_contents, LAYOUT_BOTTOM|LAYOUT_FILL_X|LAYOUT_CENTER_X);
- m_usedSpaceLabel = new FXLabel(m_spaceFrame, fbDiscUsedSpaceLabelText, NULL, LAYOUT_LEFT, 0, 0, 0, 0, 15, 5);
- m_usedSpaceField = new FXTextField(m_spaceFrame, 6, this, ID_USED_SPACE,
- TEXTFIELD_READONLY|TEXTFIELD_INTEGER|FRAME_SUNKEN|FRAME_THICK|LAYOUT_LEFT);
- m_freeSpaceLabel = new FXLabel(m_spaceFrame, fbDiscFreeSpaceLabelText, NULL, LAYOUT_LEFT, 0, 0, 0, 0, 15, 5);
- m_freeSpaceField = new FXTextField(m_spaceFrame, 6, this, ID_FREE_SPACE,
- TEXTFIELD_READONLY|TEXTFIELD_INTEGER|FRAME_SUNKEN|FRAME_THICK|LAYOUT_LEFT);
- m_percentFull = new FXProgressBar(m_spaceFrame, this, ID_PERCENT_FULL,
- FRAME_SUNKEN|FRAME_THICK|PROGRESSBAR_PERCENTAGE|PROGRESSBAR_HORIZONTAL|LAYOUT_FILL_X);
- }
- // set the base color for the main window controls
- void CFreeBurn::setMainControlsBaseColor(FXColor color, FXColor hilite, FXColor shadow)
- {
- // set the colors for all vertical frames
- m_mainFrame->setBackColor(color);
- m_mainFrame->setHiliteColor(hilite);
- m_mainFrame->setShadowColor(shadow);
-
- // set the colors for all horizontal frames
- m_spaceFrame->setBackColor(color);
- m_spaceFrame->setHiliteColor(hilite);
- m_spaceFrame->setShadowColor(shadow);
-
- // set the colors for all group boxes
- m_Group1->setBackColor(color);
- m_Group1->setHiliteColor(hilite);
- m_Group1->setShadowColor(shadow);
- m_Group2->setBackColor(color);
- m_Group2->setHiliteColor(hilite);
- m_Group2->setShadowColor(shadow);
-
- // set the colors for all matricies
- m_contentMatrix->setBackColor(color);
- m_contentMatrix->setHiliteColor(hilite);
- m_contentMatrix->setShadowColor(shadow);
- m_secondMatrix->setBackColor(color);
- m_secondMatrix->setHiliteColor(hilite);
- m_secondMatrix->setShadowColor(shadow);
-
- // set the colors for all labels
- m_DiscSizeLabel->setBackColor(color);
- m_DiscSizeLabel->setHiliteColor(hilite);
- m_DiscSizeLabel->setShadowColor(shadow);
- m_DiscTypeLabel->setBackColor(color);
- m_DiscTypeLabel->setHiliteColor(hilite);
- m_DiscTypeLabel->setShadowColor(shadow);
- m_catalogLabel->setBackColor(color);
- m_catalogLabel->setHiliteColor(hilite);
- m_catalogLabel->setShadowColor(shadow);
- m_addTrackLabel->setBackColor(color);
- m_addTrackLabel->setHiliteColor(hilite);
- m_addTrackLabel->setShadowColor(shadow);
- m_trackLabel1->setBackColor(color);
- m_trackLabel1->setHiliteColor(hilite);
- m_trackLabel1->setShadowColor(shadow);
- m_modTrackLabel->setBackColor(color);
- m_modTrackLabel->setHiliteColor(hilite);
- m_modTrackLabel->setShadowColor(shadow);
- m_usedSpaceLabel->setBackColor(color);
- m_usedSpaceLabel->setHiliteColor(hilite);
- m_usedSpaceLabel->setShadowColor(shadow);
- m_freeSpaceLabel->setBackColor(color);
- m_freeSpaceLabel->setHiliteColor(hilite);
- m_freeSpaceLabel->setShadowColor(shadow);
-
- // set the colors for all text fields
- m_sizeField->setHiliteColor(hilite);
- m_sizeField->setShadowColor(shadow);
- m_typeField->setHiliteColor(hilite);
- m_typeField->setShadowColor(shadow);
- m_catalogField->setHiliteColor(hilite);
- m_catalogField->setShadowColor(shadow);
- m_usedSpaceField->setHiliteColor(hilite);
- m_usedSpaceField->setShadowColor(shadow);
- m_freeSpaceField->setHiliteColor(hilite);
- m_freeSpaceField->setShadowColor(shadow);
-
- // set the colors for all check boxes
- m_cdTextButton->setBackColor(color);
- m_cdTextButton->setHiliteColor(hilite);
- m_cdTextButton->setShadowColor(shadow);
-
- // set the colors for all buttons
- m_editTextBut->setBackColor(color);
- m_editTextBut->setHiliteColor(hilite);
- m_editTextBut->setShadowColor(shadow);
- m_addTrackBut->setBackColor(color);
- m_addTrackBut->setHiliteColor(hilite);
- m_addTrackBut->setShadowColor(shadow);
- m_modTrackBut->setBackColor(color);
- m_modTrackBut->setHiliteColor(hilite);
- m_modTrackBut->setShadowColor(shadow);
-
- // set the colors for all option menus
- m_trackOptions->setBackColor(color);
- m_trackOptions->setHiliteColor(hilite);
- m_trackOptions->setShadowColor(shadow);
- m_modTrackOpts->setBackColor(color);
- m_modTrackOpts->setHiliteColor(hilite);
- m_modTrackOpts->setShadowColor(shadow);
-
- // set the colors for all pop-ups
- m_cddaPopup->setBackColor(color);
- m_cddaPopup->setHiliteColor(hilite);
- m_cddaPopup->setShadowColor(shadow);
- m_cdromPopup->setBackColor(color);
- m_cdromPopup->setHiliteColor(hilite);
- m_cdromPopup->setShadowColor(shadow);
- m_cdxaPopup->setBackColor(color);
- m_cdxaPopup->setHiliteColor(hilite);
- m_cdxaPopup->setShadowColor(shadow);
- m_modTrackPopup->setBackColor(color);
- m_modTrackPopup->setHiliteColor(hilite);
- m_modTrackPopup->setShadowColor(shadow);
-
- // set the colors for all options
- m_cddaAudio->setBackColor(color);
- m_cddaAudio->setHiliteColor(hilite);
- m_cddaAudio->setShadowColor(shadow);
- m_cdromData->setBackColor(color);
- m_cdromData->setHiliteColor(hilite);
- m_cdromData->setShadowColor(shadow);
- m_cdromAudio->setBackColor(color);
- m_cdromAudio->setHiliteColor(hilite);
- m_cdromAudio->setShadowColor(shadow);
- m_cdromRaw->setBackColor(color);
- m_cdromRaw->setHiliteColor(hilite);
- m_cdromRaw->setShadowColor(shadow);
- m_cdxaAudio->setBackColor(color);
- m_cdxaAudio->setHiliteColor(hilite);
- m_cdxaAudio->setShadowColor(shadow);
- m_cdxaData->setBackColor(color);
- m_cdxaData->setHiliteColor(hilite);
- m_cdxaData->setShadowColor(shadow);
- m_cdxaAudio2->setBackColor(color);
- m_cdxaAudio2->setHiliteColor(hilite);
- m_cdxaAudio2->setShadowColor(shadow);
- m_cdxaRaw->setBackColor(color);
- m_cdxaRaw->setHiliteColor(hilite);
- m_cdxaRaw->setShadowColor(shadow);
- m_editTrack->setBackColor(color);
- m_editTrack->setHiliteColor(hilite);
- m_editTrack->setShadowColor(shadow);
- m_deleteTrack->setBackColor(color);
- m_deleteTrack->setHiliteColor(hilite);
- m_deleteTrack->setShadowColor(shadow);
-
- // set the colors for all spinners
- m_modTrackNum->fbSetBaseColor(color);
- m_modTrackNum->fbSetHiliteColor(hilite);
- m_modTrackNum->fbSetShadowColor(shadow);
- }
- // set the background color for the main window controls
- void CFreeBurn::setMainControlsBackgroundColor(FXColor color)
- {
- // set the colors for all text fields
- m_sizeField->setBackColor(color);
- m_typeField->setBackColor(color);
- m_catalogField->setBackColor(color);
- m_usedSpaceField->setBackColor(color);
- m_freeSpaceField->setBackColor(color);
-
- // set the colors for all check boxes
- m_cdTextButton->setBoxColor(color);
-
- // set the colors for all spinners
- m_modTrackNum->fbSetBackgroundColor(color);
-
- // set the colors for the progress bars
- m_percentFull->setBarBGColor(color);
- }
- // set the foreground color for the main window controls
- void CFreeBurn::setMainControlsForegroundColor(FXColor color)
- {
- // set the colors for all group boxes
- m_Group1->setTextColor(color);
- m_Group2->setTextColor(color);
-
- // set the colors for all labels
- m_DiscSizeLabel->setTextColor(color);
- m_DiscTypeLabel->setTextColor(color);
- m_catalogLabel->setTextColor(color);
- m_addTrackLabel->setTextColor(color);
- m_trackLabel1->setTextColor(color);
- m_modTrackLabel->setTextColor(color);
- m_usedSpaceLabel->setTextColor(color);
- m_freeSpaceLabel->setTextColor(color);
-
- // set the colors for all text fields
- m_sizeField->setTextColor(color);
- m_typeField->setTextColor(color);
- m_catalogField->setTextColor(color);
- m_usedSpaceField->setTextColor(color);
- m_freeSpaceField->setTextColor(color);
-
- // set the colors for all check boxes
- m_cdTextButton->setTextColor(color);
-
- // set the colors for all buttons
- m_editTextBut->setTextColor(color);
- m_addTrackBut->setTextColor(color);
- m_modTrackBut->setTextColor(color);
-
- // set the colors for all option menus
- m_trackOptions->setTextColor(color);
- m_modTrackOpts->setTextColor(color);
-
- // set the colors for all options
- m_cddaAudio->setTextColor(color);
- m_cdromData->setTextColor(color);
- m_cdromAudio->setTextColor(color);
- m_cdromRaw->setTextColor(color);
- m_cdxaAudio->setTextColor(color);
- m_cdxaData->setTextColor(color);
- m_cdxaAudio2->setTextColor(color);
- m_cdxaRaw->setTextColor(color);
- m_editTrack->setTextColor(color);
- m_deleteTrack->setTextColor(color);
-
- // set the colors for all spinners
- m_modTrackNum->fbSetForegroundColor(color);
- }
- // set the border color for the main window controls
- void CFreeBurn::setMainControlsBorderColor(FXColor color)
- {
- // set the colors for all vertical frames
- m_mainFrame->setBorderColor(color);
-
- // set the colors for all horizontal frames
- m_spaceFrame->setBorderColor(color);
-
- // set the colors for all group boxes
- m_Group1->setBorderColor(color);
- m_Group2->setBorderColor(color);
-
- // set the colors for all matricies
- m_contentMatrix->setBorderColor(color);
-
- // set the colors for all labels
- m_DiscSizeLabel->setBorderColor(color);
- m_DiscTypeLabel->setBorderColor(color);
- m_catalogLabel->setBorderColor(color);
- m_addTrackLabel->setBorderColor(color);
- m_trackLabel1->setBorderColor(color);
- m_modTrackLabel->setBorderColor(color);
- m_usedSpaceLabel->setBorderColor(color);
- m_freeSpaceLabel->setBorderColor(color);
-
- // set the colors for all text fields
- m_sizeField->setBorderColor(color);
- m_typeField->setBorderColor(color);
- m_catalogField->setBorderColor(color);
- m_usedSpaceField->setBorderColor(color);
- m_freeSpaceField->setBorderColor(color);
-
- // set the colors for all check boxes
- m_cdTextButton->setBorderColor(color);
-
- // set the colors for all buttons
- m_editTextBut->setBorderColor(color);
- m_addTrackBut->setBorderColor(color);
- m_modTrackBut->setBorderColor(color);
-
- // set the colors for all option menus
- m_trackOptions->setBorderColor(color);
- m_modTrackOpts->setBorderColor(color);
-
- // set the colors for all pop-ups
- m_cddaPopup->setBorderColor(color);
- m_cdromPopup->setBorderColor(color);
- m_cdxaPopup->setBorderColor(color);
- m_modTrackPopup->setBorderColor(color);
-
- // set the colors for all options
- m_cddaAudio->setBorderColor(color);
- m_cdromData->setBorderColor(color);
- m_cdromAudio->setBorderColor(color);
- m_cdromRaw->setBorderColor(color);
- m_cdxaAudio->setBorderColor(color);
- m_cdxaData->setBorderColor(color);
- m_cdxaAudio2->setBorderColor(color);
- m_cdxaRaw->setBorderColor(color);
- m_editTrack->setBorderColor(color);
- m_deleteTrack->setBorderColor(color);
-
- // set the colors for all spinners
- m_modTrackNum->fbSetBorderColor(color);
- }
- // Save changes to the layout to a .toc file
- FXbool CFreeBurn::saveChanges()
- {
- FXuint answer;
- FXString file;
-
- // ask if the user wants to save the unsaved log file
- answer = FXMessageBox::question(this,MBOX_YES_NO_CANCEL|PLACEMENT_CURSOR,
- fbSaveChangesTitleText,fbSaveChangesMessageText);
-
- // if not, exit
- if(answer==MBOX_CLICKED_CANCEL) return FALSE;
-
- // if yes...
- if(answer==MBOX_CLICKED_YES)
- {
- /*file=m_fileName;
-
- // if we don't have a m_fileName, we need to
- // get a m_fileName. this is the same process
- // as the "save as" process.
- if(!m_haveFileName)
- {
- FXFileDialog savedialog(this,"Save Log");
- savedialog.setSelectMode(SELECTFILE_ANY);
- savedialog.setPatternList("All Files (*.*)");
- savedialog.setFilename(file);
- if(!savedialog.execute()) return FALSE;
-
- file=savedialog.getFilename();
-
- if(FXFile::exists(file))
- {
- if(MBOX_CLICKED_NO==FXMessageBox::question(this,MBOX_YES_NO,"Overwrite File",
- "Overwrite existing file: %s?",file.text())) return FALSE;
- }
- file=savedialog.getFilename();
- }
- // finally, save the file.
- saveFile(file);*/
- FXMessageBox::information(this, MBOX_OK|PLACEMENT_CURSOR, "Saving Unimplemented",
- "Saving files has not yet been implemented.");
- }
- // success
- return TRUE;
- }
- // method to close out and delete any current disc settings
- FXbool CFreeBurn::closeDisc()
- {
- if (m_discExists)
- {
- // delete/clear any data from the old layout
- delete m_mainDisc;
-
- // reset the settings of the layout flags
- m_discExists = FALSE;
- m_discSaved = TRUE;
- }
-
- return TRUE;
- }
- // Read the settings for the FreeBurn theme from the registry to set up icons and stuff
- void CFreeBurn::readThemeSettings()
- {
- m_theme = getApp()->reg().readIntEntry(fbRegSectionProgramText, fbRegPropertyThemeText, DEFAULT_THEME);
- }
- // Read registry settings for the application
- void CFreeBurn::readProgramSettings()
- {
- // read the position and height/width settings from the registry
- m_xpos = getApp()->reg().readIntEntry(fbRegSectionProgramText, fbRegPropertyXposText, FB_XPOS);
- m_ypos = getApp()->reg().readIntEntry(fbRegSectionProgramText, fbRegPropertyYposText, FB_YPOS);
- m_width = getApp()->reg().readIntEntry(fbRegSectionProgramText, fbRegPropertyWidthText, FB_WIDTH);
- m_height = getApp()->reg().readIntEntry(fbRegSectionProgramText, fbRegPropertyHeightText, FB_HEIGHT);
-
- // read the path to commands from the registry
- m_shellPath = getApp()->reg().readStringEntry(fbRegSectionCommandPathsText,
- fbRegPropertyShellPathText, fbRegDefaultShellPathText);
- m_cdrecordPath = getApp()->reg().readStringEntry(fbRegSectionCommandPathsText,
- fbRegPropertyCdrecordPathText, fbRegDefaultCdrecordPathText);
- m_mkisofsPath = getApp()->reg().readStringEntry(fbRegSectionCommandPathsText,
- fbRegPropertyMkisofsPathText, fbRegDefaultMkisofsPathText);
- m_cdrdaoPath = getApp()->reg().readStringEntry(fbRegSectionCommandPathsText,
- fbRegPropertyCdrdaoPathText, fbRegDefaultCdrdaoPathText);
-
- // Set the program options that were read from the registry
- // The x -4 offset and the y -27 offset are to account for a
- // slightly off saving of the x and y attributes of the window,
- // so the window will come up where it should
- position((m_xpos-4),(m_ypos-27),m_width,m_height);
- }
- // Write registry settings for the application
- void CFreeBurn::writeProgramSettings()
- {
- // write the current program theme to the registry
- getApp()->reg().writeIntEntry(fbRegSectionProgramText, fbRegPropertyThemeText, m_theme);
-
- // write the position, height, and width settings to the registry
- getApp()->reg().writeIntEntry(fbRegSectionProgramText, fbRegPropertyXposText, getX());
- getApp()->reg().writeIntEntry(fbRegSectionProgramText, fbRegPropertyYposText, getY());
- getApp()->reg().writeIntEntry(fbRegSectionProgramText, fbRegPropertyWidthText, getWidth());
- getApp()->reg().writeIntEntry(fbRegSectionProgramText, fbRegPropertyHeightText, getHeight());
-
- // write the external program paths to the registry
- getApp()->reg().writeStringEntry(fbRegSectionCommandPathsText,
- fbRegPropertyShellPathText, m_shellPath.text());
- getApp()->reg().writeStringEntry(fbRegSectionCommandPathsText,
- fbRegPropertyCdrecordPathText, m_cdrecordPath.text());
- getApp()->reg().writeStringEntry(fbRegSectionCommandPathsText,
- fbRegPropertyMkisofsPathText, m_mkisofsPath.text());
- getApp()->reg().writeStringEntry(fbRegSectionCommandPathsText,
- fbRegPropertyCdrdaoPathText, m_cdrdaoPath.text());
- }
- // Main program starts here
- int main(int argc,char *argv[])
- {
- // Make application
- FXApp application(FB_APP_NAME,FB_VENDOR_NAME);
-
- // set the Registry mode to use a text file,
- // and not the Windows Registry
- application.reg().setAsciiMode(TRUE);
- // Start app
- application.init(argc,argv);
- // the main program window
- CFreeBurn* fb = new CFreeBurn(&application);
-
- // now, add the process/thread event handlers since we're going to
- // be using external programs a lot to make FreeBurn work good
-
- // This event handler will handle the event that lets the app know it can
- // read a string that was output from the process
- application.addInput(fb->getReadOutputHandle(), INPUT_EXCEPT, fb, CFreeBurn::ID_GET_THREAD_BUFFER);
- // This event handler lets the app know that the process is done, so the buttons can be
- // re-enabled.
- application.addInput(fb->getThreadCompleteHandle(), INPUT_EXCEPT, fb, CFreeBurn::ID_THREAD_COMPLETE);
- // Create the application's windows
- application.create();
-
- // Run the application
- return application.run();
- }