FreeburnBurnDiscDialog.cpp
上传用户:cnxinhai
上传日期:2013-08-06
资源大小:265k
文件大小:8k
- /* This is the class definition for the Burn Disc Dialog.
- *
- * 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.
- */
- #include <fx.h>
- #include <FXPNGIcon.h>
- #include "FreeBurn.h"
- #include "FreeburnBurnDiscDialog.h"
- #include "FreeburnDefs.h"
- #include "FreeburnBurnDiscDialogText.h"
- #ifndef FREEBURN_ICONS_H
- #include "FreeburnIcons.h"
- #define FREEBURN_ICONS_H
- #endif
- // Message Map for this class
- FXDEFMAP(CFreeburnBurnDiscDialog) CFreeburnBurnDiscDialogMap[]={
- //________Message_Type________________________ID_________________________________Message_Handler___________
- FXMAPFUNC(SEL_COMMAND, CFreeburnBurnDiscDialog::ID_COMMAND_FIELD, CFreeburnBurnDiscDialog::onCmdCommandField)
- };
- FXIMPLEMENT(CFreeburnBurnDiscDialog,FXDialogBox,CFreeburnBurnDiscDialogMap,ARRAYNUMBER(CFreeburnBurnDiscDialogMap))
- // Construct help dialog box
- CFreeburnBurnDiscDialog::CFreeburnBurnDiscDialog(FXWindow* owner, FXDataTarget* burnTypeTarget):
- FXDialogBox(owner,fbBurnDiscDialogTitleText,DECOR_TITLE|DECOR_BORDER, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4)
- {
- // set up the main container for the dialog
- FXVerticalFrame* burnDiscFrame = new FXVerticalFrame(this, LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
-
- // add the title label
- new FXLabel(burnDiscFrame, fbBurnDiscDialogTitleLabelText, NULL, LAYOUT_LEFT);
-
- // add a horizontal ridge separator
- new FXHorizontalSeparator(burnDiscFrame, SEPARATOR_RIDGE|LAYOUT_FILL_X);
- // set up the radio buttons to specify using TAO recording with cdrecord
- // or DAO recording with cdrdao, as well as buttons to launch thier man pages
- // First, set up a matrix to hold them
- FXMatrix* burnProgramMatrix = new FXMatrix(burnDiscFrame, 2, MATRIX_BY_ROWS|PACK_UNIFORM_HEIGHT|LAYOUT_FILL_X);
- // this is a radio button for specifying TAO recording with cdrecord
- new FXRadioButton(burnProgramMatrix, fbBurnDiscDialogTaoBurnText, burnTypeTarget, FXDataTarget::ID_OPTION+CFreeBurn::TRACK_AT_ONCE,
- LAYOUT_CENTER_Y|LAYOUT_FILL_COLUMN|ICON_BEFORE_TEXT);
- // this is a radio button for specifying DAO recording with cdrdao
- new FXRadioButton(burnProgramMatrix, fbBurnDiscDialogDaoBurnText, burnTypeTarget, FXDataTarget::ID_OPTION+CFreeBurn::DISC_AT_ONCE,
- LAYOUT_CENTER_Y|LAYOUT_FILL_COLUMN|ICON_BEFORE_TEXT);
- // this adds a button that will show the cdrecord man page
- m_CdrecordHelp = new FXButton(burnProgramMatrix, fbBurnDiscDialogCdrecordHelpButtonText, NULL, owner,
- CFreeBurn::ID_HELP_CDRECORD, BUTTON_NORMAL);
- // this adds a button that will show the cdrdao man page
- m_CdrdaoHelp = new FXButton(burnProgramMatrix, fbBurnDiscDialogCdrdaoHelpButtonText, NULL, owner,
- CFreeBurn::ID_HELP_CDRDAO, BUTTON_NORMAL);
-
- // now add a check button that will allow an option to run the command through a UNIX shell
- m_commandFlag = new FXCheckButton(burnDiscFrame, fbBurnDiscDialogUseUnixShellText, this, ID_LAST,
- ICON_BEFORE_TEXT|LAYOUT_LEFT);
-
- // horizontal line to separate the sections
- new FXHorizontalSeparator(burnDiscFrame, SEPARATOR_LINE|LAYOUT_FILL_X);
-
- // Label identifying the text field to specify command line options
- new FXLabel(burnDiscFrame, fbBurnDiscDialogCommandLineOptsText, NULL, LAYOUT_LEFT);
- // The text field to specify the command line options
- m_commandField = new FXTextField(burnDiscFrame, 50, this, ID_COMMAND_FIELD,
- TEXTFIELD_ENTER_ONLY|FRAME_SUNKEN|FRAME_THICK|LAYOUT_LEFT);
-
- // set up the buttons for canceling or accepting changes
- new FXHorizontalSeparator(burnDiscFrame, SEPARATOR_GROOVE|LAYOUT_FILL_X);
- FXHorizontalFrame* buttonFrame = new FXHorizontalFrame(burnDiscFrame, LAYOUT_BOTTOM|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH);
- new FXButton(buttonFrame, fbBurnDiscDialogOkButtonText, NULL, this, FXDialogBox::ID_ACCEPT,
- BUTTON_DEFAULT|LAYOUT_RIGHT|FRAME_RAISED|FRAME_THICK, 0, 0, 0, 0, 20, 20);
- new FXButton(buttonFrame, fbBurnDiscDialogCancelButtonText, NULL, this, FXDialogBox::ID_CANCEL,
- LAYOUT_RIGHT|FRAME_RAISED|FRAME_THICK, 0, 0, 0, 0, 20, 20);
- }
- // Clean up
- CFreeburnBurnDiscDialog::~CFreeburnBurnDiscDialog()
- {
- }
- // set the icons for the help buttons
- void CFreeburnBurnDiscDialog::setHelpIcon(FXIcon* helpIcon)
- {
- m_CdrecordHelp->setIcon(helpIcon);
- m_CdrdaoHelp->setIcon(helpIcon);
- }
- // set the use unix shell flag
- void CFreeburnBurnDiscDialog::setShellFlag(FXbool flag)
- {
- m_commandFlag->setCheck(flag);
- }
- // get the use unix shell flag
- FXbool CFreeburnBurnDiscDialog::getShellFlag()
- {
- return m_commandFlag->getCheck();
- }
- // set the command line string
- void CFreeburnBurnDiscDialog::setCommandString(FXString string)
- {
- m_commandField->setText(string);
- }
- // get the command line string
- FXString CFreeburnBurnDiscDialog::getCommandString()
- {
- return m_commandField->getText();
- }
- long CFreeburnBurnDiscDialog::onCmdCommandField(FXObject* sender, FXSelector sel, void* ptr)
- {
- // on an accept from the text area (enter on the keyboard), close the dialog
- FXDialogBox::onCmdAccept(sender, sel, ptr);
-
- return 1;
- }