Renamed UICommonDialog to UIFileDialog.

This commit is contained in:
Martín Lucas Golini
2020-06-11 14:15:30 -03:00
parent 9c4f24c3cb
commit 82f4fc1656
14 changed files with 141 additions and 133 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
#include <eepp/maps/maplight.hpp>
#include <eepp/ui/tools/textureatlaseditor.hpp>
#include <eepp/ui/uicheckbox.hpp>
#include <eepp/ui/uicommondialog.hpp>
#include <eepp/ui/uifiledialog.hpp>
#include <eepp/ui/uimenucheckbox.hpp>
#include <eepp/ui/uimessagebox.hpp>
#include <eepp/ui/uipopupmenu.hpp>
+1 -1
View File
@@ -6,7 +6,7 @@
#include <eepp/ui/uicheckbox.hpp>
#include <eepp/ui/uicodeeditor.hpp>
#include <eepp/ui/uicombobox.hpp>
#include <eepp/ui/uicommondialog.hpp>
#include <eepp/ui/uifiledialog.hpp>
#include <eepp/ui/uidropdownlist.hpp>
#include <eepp/ui/uigridlayout.hpp>
#include <eepp/ui/uiimage.hpp>
@@ -1,5 +1,5 @@
#ifndef EE_UICUICOMMONDIALOG_HPP
#define EE_UICUICOMMONDIALOG_HPP
#ifndef EE_UI_UIFILEDIALOG_HPP
#define EE_UI_UIFILEDIALOG_HPP
#include <eepp/ui/base.hpp>
#include <eepp/ui/uicombobox.hpp>
@@ -11,25 +11,25 @@
namespace EE { namespace UI {
enum UICommonDialogFlags {
CDL_FLAG_SAVE_DIALOG = ( 1 << 0 ),
CDL_FLAG_FOLDERS_FISRT = ( 1 << 1 ),
CDL_FLAG_SORT_ALPHABETICALLY = ( 1 << 2 ),
CDL_FLAG_ALLOW_FOLDER_SELECT = ( 1 << 3 )
};
static const Uint32 UI_CDL_DEFAULT_FLAGS = CDL_FLAG_FOLDERS_FISRT | CDL_FLAG_SORT_ALPHABETICALLY;
class EE_API UICommonDialog : public UIWindow {
class EE_API UIFileDialog : public UIWindow {
public:
static UICommonDialog* New( Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS,
std::string DefaultFilePattern = "*",
std::string DefaultDirectory = Sys::getProcessPath() );
enum Flags {
SaveDialog = ( 1 << 0 ),
FoldersFirst = ( 1 << 1 ),
SortAlphabetically = ( 1 << 2 ),
AllowFolderSelect = ( 1 << 3 )
};
UICommonDialog( Uint32 CDLFlags = UI_CDL_DEFAULT_FLAGS, std::string DefaultFilePattern = "*",
std::string DefaultDirectory = Sys::getProcessPath() );
static const Uint32 DefaultFlags = FoldersFirst | SortAlphabetically;
virtual ~UICommonDialog();
static UIFileDialog* New( Uint32 dialogFlags = DefaultFlags,
std::string defaultFilePattern = "*",
std::string defaultDirectory = Sys::getProcessPath() );
UIFileDialog( Uint32 dialogFlags = DefaultFlags, std::string defaultFilePattern = "*",
std::string defaultDirectory = Sys::getProcessPath() );
virtual ~UIFileDialog();
virtual Uint32 getType() const;
@@ -94,7 +94,7 @@ class EE_API UICommonDialog : public UIWindow {
UITextInput* mPath;
UITextInput* mFile;
UIDropDownList* mFiletype;
Uint32 mCDLFlags;
Uint32 mDialogFlags;
Uint32 mCloseWithKey;
virtual void onWindowReady();
+1 -1
View File
@@ -75,7 +75,7 @@ enum UINodeType {
UI_TYPE_MENUBAR,
UI_TYPE_SELECTBUTTON,
UI_TYPE_POPUPMENU,
UI_TYPE_COMMONDIALOG,
UI_TYPE_FILEDIALOG,
UI_TYPE_TAB,
UI_TYPE_TABWIDGET,
UI_TYPE_LOADER,
+2 -2
View File
@@ -335,9 +335,9 @@
../../include/eepp/ui/uicheckbox.hpp
../../include/eepp/ui/uicodeeditor.hpp
../../include/eepp/ui/uicombobox.hpp
../../include/eepp/ui/uicommondialog.hpp
../../include/eepp/ui/uidropdownlist.hpp
../../include/eepp/ui/uieventdispatcher.hpp
../../include/eepp/ui/uifiledialog.hpp
../../include/eepp/ui/uifontstyleconfig.hpp
../../include/eepp/ui/uigridlayout.hpp
../../include/eepp/ui/uihelper.hpp
@@ -787,9 +787,9 @@
../../src/eepp/ui/uicheckbox.cpp
../../src/eepp/ui/uicodeeditor.cpp
../../src/eepp/ui/uicombobox.cpp
../../src/eepp/ui/uicommondialog.cpp
../../src/eepp/ui/uidropdownlist.cpp
../../src/eepp/ui/uieventdispatcher.cpp
../../src/eepp/ui/uifiledialog.cpp
../../src/eepp/ui/uigridlayout.cpp
../../src/eepp/ui/uiimage.cpp
../../src/eepp/ui/uilayout.cpp
+8 -8
View File
@@ -1083,7 +1083,7 @@ void MapEditor::updateScroll() {
}
void MapEditor::mapOpen( const Event* Event ) {
UICommonDialog* CDL = Event->getNode()->asType<UICommonDialog>();
UIFileDialog* CDL = Event->getNode()->asType<UIFileDialog>();
if ( mUIMap->Map()->loadFromFile( CDL->getFullPath() ) ) {
onMapLoad();
@@ -1103,7 +1103,7 @@ void MapEditor::onMapLoad() {
}
void MapEditor::mapSave( const Event* Event ) {
UICommonDialog* CDL = Event->getNode()->asType<UICommonDialog>();
UIFileDialog* CDL = Event->getNode()->asType<UIFileDialog>();
std::string path( CDL->getFullPath() );
@@ -1123,15 +1123,15 @@ void MapEditor::fileMenuClick( const Event* Event ) {
if ( "New..." == txt ) {
createNewMap();
} else if ( "Open..." == txt ) {
UICommonDialog* TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS, "*.eem" );
UIFileDialog* TGDialog = UIFileDialog::New( UIFileDialog::DefaultFlags, "*.eem" );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Open Map" );
TGDialog->addEventListener( Event::OpenFile, cb::Make1( this, &MapEditor::mapOpen ) );
TGDialog->center();
TGDialog->show();
} else if ( "Save As..." == txt ) {
UICommonDialog* TGDialog =
UICommonDialog::New( UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*.eem" );
UIFileDialog* TGDialog =
UIFileDialog::New( UIFileDialog::DefaultFlags | UIFileDialog::SaveDialog, "*.eem" );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Save Map" );
TGDialog->addEventListener( Event::SaveFile, cb::Make1( this, &MapEditor::mapSave ) );
@@ -1265,8 +1265,8 @@ void MapEditor::mapMenuClick( const Event* Event ) {
tWin->center();
tWin->show();
} else if ( "Add External Texture Atlas..." == txt ) {
UICommonDialog* TGDialog = UICommonDialog::New(
UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION );
UIFileDialog* TGDialog = UIFileDialog::New(
UIFileDialog::DefaultFlags, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Load Texture Atlas..." );
TGDialog->addEventListener( Event::OpenFile,
@@ -1380,7 +1380,7 @@ void MapEditor::refreshLayersList() {
}
void MapEditor::cextureAtlasOpen( const Event* Event ) {
UICommonDialog* CDL = Event->getNode()->asType<UICommonDialog>();
UIFileDialog* CDL = Event->getNode()->asType<UIFileDialog>();
std::string sgname =
FileSystem::fileRemoveExtension( FileSystem::fileNameFromPath( CDL->getFullPath() ) );
+4 -4
View File
@@ -4,7 +4,7 @@
#include <eepp/ui/tools/textureatlaseditor.hpp>
#include <eepp/ui/tools/textureatlasnew.hpp>
#include <eepp/ui/tools/textureatlastextureregioneditor.hpp>
#include <eepp/ui/uicommondialog.hpp>
#include <eepp/ui/uifiledialog.hpp>
#include <eepp/ui/uimenuitem.hpp>
#include <eepp/ui/uimessagebox.hpp>
#include <eepp/ui/uipopupmenu.hpp>
@@ -293,8 +293,8 @@ void TextureAtlasEditor::fileMenuClick( const Event* Event ) {
if ( "New..." == txt ) {
eeNew( TextureAtlasNew, ( cb::Make1( this, &TextureAtlasEditor::onTextureAtlasCreate ) ) );
} else if ( "Open..." == txt ) {
UICommonDialog* TGDialog = UICommonDialog::New(
UI_CDL_DEFAULT_FLAGS, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION );
UIFileDialog* TGDialog = UIFileDialog::New(
UIFileDialog::DefaultFlags, std::string( "*" ) + EE_TEXTURE_ATLAS_EXTENSION );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Open Texture Atlas" );
TGDialog->addEventListener( Event::OpenFile,
@@ -448,7 +448,7 @@ void TextureAtlasEditor::openTextureAtlas( const Event* Event ) {
eeSAFE_DELETE( mTextureAtlasLoader );
mTextureAtlasLoader = TextureAtlasLoader::New(
Event->getNode()->asType<UICommonDialog>()->getFullPath(), Engine::instance()->isThreaded(),
Event->getNode()->asType<UIFileDialog>()->getFullPath(), Engine::instance()->isThreaded(),
cb::Make1( this, &TextureAtlasEditor::onTextureAtlasLoaded ) );
}
+7 -7
View File
@@ -2,7 +2,7 @@
#include <eepp/scene/scenemanager.hpp>
#include <eepp/system/filesystem.hpp>
#include <eepp/ui/tools/textureatlasnew.hpp>
#include <eepp/ui/uicommondialog.hpp>
#include <eepp/ui/uifiledialog.hpp>
#include <eepp/ui/uimessagebox.hpp>
#include <eepp/ui/uiscenenode.hpp>
#include <eepp/ui/uithememanager.hpp>
@@ -128,8 +128,8 @@ void TextureAtlasNew::okClick( const Event* event ) {
std::string ext( mSaveFileType->getText() );
String::toLowerInPlace( ext );
UICommonDialog* TGDialog =
UICommonDialog::New( UI_CDL_DEFAULT_FLAGS | CDL_FLAG_SAVE_DIALOG, "*." + ext );
UIFileDialog* TGDialog =
UIFileDialog::New( UIFileDialog::DefaultFlags | UIFileDialog::SaveDialog, "*." + ext );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Save Texture Atlas" );
TGDialog->addEventListener( Event::SaveFile,
@@ -156,7 +156,7 @@ static bool isValidExtension( const std::string& ext ) {
}
void TextureAtlasNew::textureAtlasSave( const Event* Event ) {
std::string FPath( Event->getNode()->asType<UICommonDialog>()->getFullPath() );
std::string FPath( Event->getNode()->asType<UIFileDialog>()->getFullPath() );
if ( !FileSystem::isDirectory( FPath ) ) {
Int32 w = 0, h = 0, b;
@@ -206,8 +206,8 @@ void TextureAtlasNew::onDialogFolderSelect( const Event* event ) {
const MouseEvent* mouseEvent = reinterpret_cast<const MouseEvent*>( event );
if ( mouseEvent->getFlags() & EE_BUTTON_LMASK ) {
UICommonDialog* TGDialog =
UICommonDialog::New( UI_CDL_DEFAULT_FLAGS | CDL_FLAG_ALLOW_FOLDER_SELECT, "*" );
UIFileDialog* TGDialog =
UIFileDialog::New( UIFileDialog::DefaultFlags | UIFileDialog::AllowFolderSelect, "*" );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Create Texture Atlas ( Select Folder Containing Textures )" );
TGDialog->addEventListener( Event::OpenFile,
@@ -218,7 +218,7 @@ void TextureAtlasNew::onDialogFolderSelect( const Event* event ) {
}
void TextureAtlasNew::onSelectFolder( const Event* Event ) {
UICommonDialog* CDL = Event->getNode()->asType<UICommonDialog>();
UIFileDialog* CDL = Event->getNode()->asType<UIFileDialog>();
UIMessageBox* MsgBox;
std::string FPath( CDL->getFullPath() );
FileSystem::dirPathAddSlashAtEnd( FPath );
+6
View File
@@ -1248,6 +1248,7 @@ void UICodeEditor::drawSelectionMatch( const std::pair<int, int>& lineRange,
const Vector2f& startScroll, const Float& lineHeight ) {
if ( !mDoc.hasSelection() )
return;
Primitives primitives;
primitives.setForceDraw( false );
primitives.setColor( Color( mSelectionMatchColor ).blendAlpha( mAlpha ) );
@@ -1257,6 +1258,11 @@ void UICodeEditor::drawSelectionMatch( const std::pair<int, int>& lineRange,
String text( selectionLine.substr( selection.start().column(),
selection.end().column() - selection.start().column() ) );
if ( ( text[0] == '\t' && text.countChar( '\t' ) == text.size() ) ||
( text[0] == ' ' && text.countChar( ' ' ) == text.size() ) ) {
return;
}
for ( auto ln = lineRange.first; ln <= lineRange.second; ln++ ) {
const String& line = mDoc.line( ln ).getText();
size_t pos = 0;
@@ -1,6 +1,6 @@
#include <algorithm>
#include <eepp/system/filesystem.hpp>
#include <eepp/ui/uicommondialog.hpp>
#include <eepp/ui/uifiledialog.hpp>
#include <eepp/ui/uilinearlayout.hpp>
#include <eepp/ui/uilistboxitem.hpp>
#include <eepp/ui/uiscenenode.hpp>
@@ -9,32 +9,35 @@
namespace EE { namespace UI {
#define CDLG_MIN_WIDTH 420
#define CDLG_MIN_HEIGHT 320
#define FDLG_MIN_WIDTH 420
#define FDLG_MIN_HEIGHT 320
UICommonDialog* UICommonDialog::New( Uint32 CDLFlags, std::string DefaultFilePattern,
std::string DefaultDirectory ) {
return eeNew( UICommonDialog, ( CDLFlags, DefaultFilePattern, DefaultDirectory ) );
UIFileDialog* UIFileDialog::New( Uint32 dialogFlags, std::string defaultFilePattern,
std::string defaultDirectory ) {
return eeNew( UIFileDialog, ( dialogFlags, defaultFilePattern, defaultDirectory ) );
}
UICommonDialog::UICommonDialog( Uint32 CDLFlags, std::string DefaultFilePattern,
std::string DefaultDirectory ) :
UIWindow(), mCurPath( DefaultDirectory ), mCDLFlags( CDLFlags ), mCloseWithKey( KEY_UNKNOWN ) {
if ( getSize().getWidth() < CDLG_MIN_WIDTH ) {
mDpSize.x = CDLG_MIN_WIDTH;
mSize.x = PixelDensity::dpToPxI( CDLG_MIN_WIDTH );
UIFileDialog::UIFileDialog( Uint32 dialogFlags, std::string defaultFilePattern,
std::string defaultDirectory ) :
UIWindow(),
mCurPath( defaultDirectory ),
mDialogFlags( dialogFlags ),
mCloseWithKey( KEY_UNKNOWN ) {
if ( getSize().getWidth() < FDLG_MIN_WIDTH ) {
mDpSize.x = FDLG_MIN_WIDTH;
mSize.x = PixelDensity::dpToPxI( FDLG_MIN_WIDTH );
}
if ( getSize().getHeight() < CDLG_MIN_HEIGHT ) {
mDpSize.y = CDLG_MIN_HEIGHT;
mSize.y = PixelDensity::dpToPxI( CDLG_MIN_HEIGHT );
if ( getSize().getHeight() < FDLG_MIN_HEIGHT ) {
mDpSize.y = FDLG_MIN_HEIGHT;
mSize.y = PixelDensity::dpToPxI( FDLG_MIN_HEIGHT );
}
if ( mStyleConfig.MinWindowSize.getWidth() < CDLG_MIN_WIDTH )
mStyleConfig.MinWindowSize.setWidth( CDLG_MIN_WIDTH );
if ( mStyleConfig.MinWindowSize.getWidth() < FDLG_MIN_WIDTH )
mStyleConfig.MinWindowSize.setWidth( FDLG_MIN_WIDTH );
if ( mStyleConfig.MinWindowSize.getHeight() < CDLG_MIN_HEIGHT )
mStyleConfig.MinWindowSize.setHeight( CDLG_MIN_HEIGHT );
if ( mStyleConfig.MinWindowSize.getHeight() < FDLG_MIN_HEIGHT )
mStyleConfig.MinWindowSize.setHeight( FDLG_MIN_HEIGHT );
bool loading = isSceneNodeLoading();
mUISceneNode->setIsLoading( true );
@@ -70,8 +73,7 @@ UICommonDialog::UICommonDialog( Uint32 CDLFlags, std::string DefaultFilePattern,
->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::WrapContent )
->setLayoutWeight( 1 )
->setParent( hLayout );
mPath->addEventListener( Event::OnPressEnter,
cb::Make1( this, &UICommonDialog::onPressEnter ) );
mPath->addEventListener( Event::OnPressEnter, cb::Make1( this, &UIFileDialog::onPressEnter ) );
mButtonUp = UIPushButton::New();
mButtonUp->setText( "Up" )
@@ -116,7 +118,7 @@ UICommonDialog::UICommonDialog( Uint32 CDLFlags, std::string DefaultFilePattern,
->setParent( hLayout );
mFile->setLayoutMargin( Rect( 0, 0, 4, 0 ) );
mFile->addEventListener( Event::OnPressEnter,
cb::Make1( this, &UICommonDialog::onPressFileEnter ) );
cb::Make1( this, &UIFileDialog::onPressFileEnter ) );
mButtonOpen = UIPushButton::New();
mButtonOpen->setText( isSaveDialog() ? "Save" : "Open" )
@@ -140,7 +142,7 @@ UICommonDialog::UICommonDialog( Uint32 CDLFlags, std::string DefaultFilePattern,
->setLayoutWeight( 1 )
->setParent( hLayout );
mFiletype->setPopUpToRoot( true );
mFiletype->getListBox()->addListBoxItem( DefaultFilePattern );
mFiletype->getListBox()->addListBoxItem( defaultFilePattern );
mFiletype->getListBox()->setSelected( 0 );
mFiletype->setLayoutMargin( Rect( 0, 0, 4, 0 ) );
@@ -155,21 +157,21 @@ UICommonDialog::UICommonDialog( Uint32 CDLFlags, std::string DefaultFilePattern,
mUISceneNode->setIsLoading( loading );
}
UICommonDialog::~UICommonDialog() {}
UIFileDialog::~UIFileDialog() {}
void UICommonDialog::onWindowReady() {
void UIFileDialog::onWindowReady() {
updateClickStep();
}
Uint32 UICommonDialog::getType() const {
return UI_TYPE_COMMONDIALOG;
Uint32 UIFileDialog::getType() const {
return UI_TYPE_FILEDIALOG;
}
bool UICommonDialog::isType( const Uint32& type ) const {
return UICommonDialog::getType() == type ? true : UIWindow::isType( type );
bool UIFileDialog::isType( const Uint32& type ) const {
return UIFileDialog::getType() == type ? true : UIWindow::isType( type );
}
void UICommonDialog::setTheme( UITheme* Theme ) {
void UIFileDialog::setTheme( UITheme* Theme ) {
UIWindow::setTheme( Theme );
mButtonOpen->setTheme( Theme );
@@ -190,7 +192,7 @@ void UICommonDialog::setTheme( UITheme* Theme ) {
onThemeLoaded();
}
void UICommonDialog::refreshFolder() {
void UIFileDialog::refreshFolder() {
std::vector<String> flist = FileSystem::filesGetInPath( String( mCurPath ) );
std::vector<String> files;
std::vector<String> folders;
@@ -245,7 +247,7 @@ void UICommonDialog::refreshFolder() {
mList->setFocus();
}
void UICommonDialog::updateClickStep() {
void UIFileDialog::updateClickStep() {
if ( NULL != mList->getVerticalScrollBar() ) {
mList->getVerticalScrollBar()->setClickStep(
1.f / ( ( mList->getCount() * mList->getRowHeight() ) /
@@ -253,7 +255,7 @@ void UICommonDialog::updateClickStep() {
}
}
void UICommonDialog::openSaveClick() {
void UIFileDialog::openSaveClick() {
if ( isSaveDialog() ) {
save();
} else {
@@ -261,11 +263,11 @@ void UICommonDialog::openSaveClick() {
}
}
void UICommonDialog::onPressFileEnter( const Event* ) {
void UIFileDialog::onPressFileEnter( const Event* ) {
openSaveClick();
}
void UICommonDialog::disableButtons() {
void UIFileDialog::disableButtons() {
mButtonOpen->setEnabled( false );
mButtonCancel->setEnabled( false );
mButtonUp->setEnabled( false );
@@ -280,7 +282,7 @@ void UICommonDialog::disableButtons() {
mButtonMaximize->setEnabled( false );
}
void UICommonDialog::openFileOrFolder() {
void UIFileDialog::openFileOrFolder() {
std::string newPath = mCurPath + mList->getItemSelectedText();
if ( FileSystem::isDirectory( newPath ) ) {
@@ -292,13 +294,13 @@ void UICommonDialog::openFileOrFolder() {
}
}
void UICommonDialog::goFolderUp() {
void UIFileDialog::goFolderUp() {
mCurPath = FileSystem::removeLastFolderFromPath( mCurPath );
mPath->setText( mCurPath );
refreshFolder();
}
Uint32 UICommonDialog::onMessage( const NodeMessage* Msg ) {
Uint32 UIFileDialog::onMessage( const NodeMessage* Msg ) {
switch ( Msg->getMsg() ) {
case NodeMessage::Click: {
if ( Msg->getFlags() & EE_BUTTON_LMASK ) {
@@ -350,7 +352,7 @@ Uint32 UICommonDialog::onMessage( const NodeMessage* Msg ) {
return UIWindow::onMessage( Msg );
}
void UICommonDialog::save() {
void UIFileDialog::save() {
sendCommonEvent( Event::SaveFile );
disableButtons();
@@ -358,7 +360,7 @@ void UICommonDialog::save() {
closeWindow();
}
void UICommonDialog::open() {
void UIFileDialog::open() {
if ( "" != mList->getItemSelectedText() || getAllowFolderSelect() ) {
if ( !getAllowFolderSelect() ) {
if ( FileSystem::isDirectory( getFullPath() ) )
@@ -377,7 +379,7 @@ void UICommonDialog::open() {
}
}
void UICommonDialog::onPressEnter( const Event* ) {
void UIFileDialog::onPressEnter( const Event* ) {
if ( FileSystem::isDirectory( mPath->getText() ) ) {
std::string tpath = mPath->getText();
FileSystem::dirPathAddSlashAtEnd( tpath );
@@ -387,7 +389,7 @@ void UICommonDialog::onPressEnter( const Event* ) {
}
}
void UICommonDialog::addFilePattern( std::string pattern, bool select ) {
void UIFileDialog::addFilePattern( std::string pattern, bool select ) {
Uint32 index = mFiletype->getListBox()->addListBoxItem( pattern );
if ( select ) {
@@ -397,37 +399,37 @@ void UICommonDialog::addFilePattern( std::string pattern, bool select ) {
}
}
bool UICommonDialog::isSaveDialog() {
return 0 != ( mCDLFlags & CDL_FLAG_SAVE_DIALOG );
bool UIFileDialog::isSaveDialog() {
return 0 != ( mDialogFlags & SaveDialog );
}
bool UICommonDialog::getSortAlphabetically() {
return 0 != ( mCDLFlags & CDL_FLAG_SORT_ALPHABETICALLY );
bool UIFileDialog::getSortAlphabetically() {
return 0 != ( mDialogFlags & SortAlphabetically );
}
bool UICommonDialog::getFoldersFirst() {
return 0 != ( mCDLFlags & CDL_FLAG_FOLDERS_FISRT );
bool UIFileDialog::getFoldersFirst() {
return 0 != ( mDialogFlags & FoldersFirst );
}
bool UICommonDialog::getAllowFolderSelect() {
return 0 != ( mCDLFlags & CDL_FLAG_ALLOW_FOLDER_SELECT );
bool UIFileDialog::getAllowFolderSelect() {
return 0 != ( mDialogFlags & AllowFolderSelect );
}
void UICommonDialog::setSortAlphabetically( const bool& sortAlphabetically ) {
BitOp::setBitFlagValue( &mCDLFlags, CDL_FLAG_SORT_ALPHABETICALLY, sortAlphabetically ? 1 : 0 );
void UIFileDialog::setSortAlphabetically( const bool& sortAlphabetically ) {
BitOp::setBitFlagValue( &mDialogFlags, SortAlphabetically, sortAlphabetically ? 1 : 0 );
refreshFolder();
}
void UICommonDialog::setFoldersFirst( const bool& foldersFirst ) {
BitOp::setBitFlagValue( &mCDLFlags, CDL_FLAG_FOLDERS_FISRT, foldersFirst ? 1 : 0 );
void UIFileDialog::setFoldersFirst( const bool& foldersFirst ) {
BitOp::setBitFlagValue( &mDialogFlags, FoldersFirst, foldersFirst ? 1 : 0 );
refreshFolder();
}
void UICommonDialog::setAllowFolderSelect( const bool& allowFolderSelect ) {
BitOp::setBitFlagValue( &mCDLFlags, CDL_FLAG_ALLOW_FOLDER_SELECT, allowFolderSelect ? 1 : 0 );
void UIFileDialog::setAllowFolderSelect( const bool& allowFolderSelect ) {
BitOp::setBitFlagValue( &mDialogFlags, AllowFolderSelect, allowFolderSelect ? 1 : 0 );
}
std::string UICommonDialog::getFullPath() {
std::string UIFileDialog::getFullPath() {
std::string tPath = mCurPath;
FileSystem::dirPathAddSlashAtEnd( tPath );
@@ -437,7 +439,7 @@ std::string UICommonDialog::getFullPath() {
return tPath;
}
std::string UICommonDialog::getTempFullPath() {
std::string UIFileDialog::getTempFullPath() {
std::string tPath = mCurPath;
FileSystem::dirPathAddSlashAtEnd( tPath );
@@ -447,46 +449,46 @@ std::string UICommonDialog::getTempFullPath() {
return tPath;
}
std::string UICommonDialog::getCurPath() const {
std::string UIFileDialog::getCurPath() const {
return mCurPath;
}
std::string UICommonDialog::getCurFile() const {
if ( mCDLFlags & CDL_FLAG_SAVE_DIALOG )
std::string UIFileDialog::getCurFile() const {
if ( mDialogFlags & SaveDialog )
return mFile->getText();
return mList->getItemSelectedText().toUtf8();
}
UIPushButton* UICommonDialog::getButtonOpen() const {
UIPushButton* UIFileDialog::getButtonOpen() const {
return mButtonOpen;
}
UIPushButton* UICommonDialog::getButtonCancel() const {
UIPushButton* UIFileDialog::getButtonCancel() const {
return mButtonCancel;
}
UIPushButton* UICommonDialog::getButtonUp() const {
UIPushButton* UIFileDialog::getButtonUp() const {
return mButtonUp;
}
UIListBox* UICommonDialog::getList() const {
UIListBox* UIFileDialog::getList() const {
return mList;
}
UITextInput* UICommonDialog::getPathInput() const {
UITextInput* UIFileDialog::getPathInput() const {
return mPath;
}
UITextInput* UICommonDialog::getFileInput() const {
UITextInput* UIFileDialog::getFileInput() const {
return mFile;
}
UIDropDownList* UICommonDialog::getFiletypeList() const {
UIDropDownList* UIFileDialog::getFiletypeList() const {
return mFiletype;
}
Uint32 UICommonDialog::onKeyUp( const KeyEvent& Event ) {
Uint32 UIFileDialog::onKeyUp( const KeyEvent& Event ) {
if ( mCloseWithKey && Event.getKeyCode() == mCloseWithKey ) {
disableButtons();
@@ -496,11 +498,11 @@ Uint32 UICommonDialog::onKeyUp( const KeyEvent& Event ) {
return 1;
}
const Uint32& UICommonDialog::getCloseWithKey() const {
const Uint32& UIFileDialog::getCloseWithKey() const {
return mCloseWithKey;
}
void UICommonDialog::setCloseWithKey( const Uint32& closeWithKey ) {
void UIFileDialog::setCloseWithKey( const Uint32& closeWithKey ) {
mCloseWithKey = closeWithKey;
}
+3 -3
View File
@@ -1038,8 +1038,8 @@ void EETest::createColorPicker( Node* node ) {
// mColorPicker->getUIWindow()->center();
}
void EETest::createCommonDialog() {
UICommonDialog* CDialog = UICommonDialog::New();
void EETest::createFileDialog() {
UIFileDialog* CDialog = UIFileDialog::New();
CDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON );
CDialog->addFilePattern( "*.hpp;*.cpp", true );
CDialog->center();
@@ -1237,7 +1237,7 @@ void EETest::onItemClick( const Event* event ) {
} else if ( "Multi Viewport" == txt ) {
MultiViewportMode = !MultiViewportMode;
} else if ( "Open..." == txt ) {
createCommonDialog();
createFileDialog();
} else if ( "New" == txt ) {
if ( 0 == Screen ) {
changeDemo( 0 );
+1 -1
View File
@@ -143,7 +143,7 @@ class EETest : private Thread {
Clock mFTE;
Translator mTranslator;
void createCommonDialog();
void createFileDialog();
void onItemClick( const Event* Event );
void onMainClick( const Event* Event );
void onQuitClick( const Event* Event );
+3 -3
View File
@@ -486,7 +486,7 @@ void App::loadFileFromPath( const std::string& path, UICodeEditor* codeEditor )
}
void App::openFileDialog() {
UICommonDialog* TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS, "*" );
UIFileDialog* TGDialog = UIFileDialog::New();
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Open layout..." );
TGDialog->setCloseWithKey( KEY_ESCAPE );
@@ -494,7 +494,7 @@ void App::openFileDialog() {
auto d = createCodeEditorInTabWidget( tabWidgetFromEditor( mCurEditor ) );
UITabWidget* tabWidget = d.first->getTabWidget();
UITab* addedTab = d.first;
loadFileFromPath( event->getNode()->asType<UICommonDialog>()->getFullPath(), d.second );
loadFileFromPath( event->getNode()->asType<UIFileDialog>()->getFullPath(), d.second );
tabWidget->setTabSelected( addedTab );
UITab* firstTab = tabWidget->getTab( 0 );
if ( addedTab != firstTab ) {
@@ -871,7 +871,7 @@ void App::init( const std::string& file ) {
mUISceneNode->getRoot()->addClass( "appbackground" );
std::string baseUI = R"xml(
const std::string baseUI = R"xml(
<style>
TextInput#search_find,
TextInput#search_replace {
+12 -12
View File
@@ -813,23 +813,23 @@ void mainLoop() {
}
void imagePathOpen( const Event* event ) {
loadImagesFromFolder( event->getNode()->asType<UICommonDialog>()->getFullPath() );
loadImagesFromFolder( event->getNode()->asType<UIFileDialog>()->getFullPath() );
}
void fontPathOpen( const Event* event ) {
loadFontsFromFolder( event->getNode()->asType<UICommonDialog>()->getFullPath() );
loadFontsFromFolder( event->getNode()->asType<UIFileDialog>()->getFullPath() );
}
void styleSheetPathOpen( const Event* event ) {
loadStyleSheet( event->getNode()->asType<UICommonDialog>()->getFullPath() );
loadStyleSheet( event->getNode()->asType<UIFileDialog>()->getFullPath() );
}
void layoutOpen( const Event* event ) {
loadLayoutFile( event->getNode()->asType<UICommonDialog>()->getFullPath() );
loadLayoutFile( event->getNode()->asType<UIFileDialog>()->getFullPath() );
}
void projectOpen( const Event* event ) {
loadProject( event->getNode()->asType<UICommonDialog>()->getFullPath() );
loadProject( event->getNode()->asType<UIFileDialog>()->getFullPath() );
}
void fileMenuClick( const Event* event ) {
@@ -841,7 +841,7 @@ void fileMenuClick( const Event* event ) {
SceneManager::instance()->setCurrentUISceneNode( appUiSceneNode );
if ( "Open project..." == txt ) {
UICommonDialog* TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS, "*.xml" );
UIFileDialog* TGDialog = UIFileDialog::New( UIFileDialog::DefaultFlags, "*.xml" );
TGDialog->setTheme( theme );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Open layout..." );
@@ -849,7 +849,7 @@ void fileMenuClick( const Event* event ) {
TGDialog->center();
TGDialog->show();
} else if ( "Open layout..." == txt ) {
UICommonDialog* TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS, "*.xml" );
UIFileDialog* TGDialog = UIFileDialog::New( UIFileDialog::DefaultFlags, "*.xml" );
TGDialog->setTheme( theme );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Open layout..." );
@@ -861,8 +861,8 @@ void fileMenuClick( const Event* event ) {
} else if ( "Quit" == txt ) {
onCloseRequestCallback( window );
} else if ( "Load images from path..." == txt ) {
UICommonDialog* TGDialog =
UICommonDialog::New( UI_CDL_DEFAULT_FLAGS | CDL_FLAG_ALLOW_FOLDER_SELECT );
UIFileDialog* TGDialog =
UIFileDialog::New( UIFileDialog::DefaultFlags | UIFileDialog::AllowFolderSelect );
TGDialog->setTheme( theme );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Open images from folder..." );
@@ -870,8 +870,8 @@ void fileMenuClick( const Event* event ) {
TGDialog->center();
TGDialog->show();
} else if ( "Load fonts from path..." == txt ) {
UICommonDialog* TGDialog =
UICommonDialog::New( UI_CDL_DEFAULT_FLAGS | CDL_FLAG_ALLOW_FOLDER_SELECT );
UIFileDialog* TGDialog =
UIFileDialog::New( UIFileDialog::DefaultFlags | UIFileDialog::AllowFolderSelect );
TGDialog->setTheme( theme );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Open fonts from folder..." );
@@ -879,7 +879,7 @@ void fileMenuClick( const Event* event ) {
TGDialog->center();
TGDialog->show();
} else if ( "Load style sheet from path..." == txt ) {
UICommonDialog* TGDialog = UICommonDialog::New( UI_CDL_DEFAULT_FLAGS, "*.css" );
UIFileDialog* TGDialog = UIFileDialog::New( UIFileDialog::DefaultFlags, "*.css" );
TGDialog->setTheme( theme );
TGDialog->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_MODAL );
TGDialog->setTitle( "Open style sheet from path..." );