mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-10 03:44:16 +00:00
Move the "new folder dialog" to its own xml to automatically generate its widget
This commit is contained in:
parent
726013e0bd
commit
c6f2c48d66
@ -29,20 +29,4 @@
|
||||
</grid>
|
||||
</vbox>
|
||||
</window>
|
||||
|
||||
<window text="New Folder" id="newfolder_dialog">
|
||||
<vbox>
|
||||
<hbox>
|
||||
<label text="Folder Name:" />
|
||||
<entry text="New Folder" id="name" maxsize="256" magnet="true" expansive="true" />
|
||||
</hbox>
|
||||
<hbox>
|
||||
<boxfiller />
|
||||
<hbox homogeneous="true">
|
||||
<button text="&OK" closewindow="true" id="ok" magnet="true" width="60" />
|
||||
<button text="&Cancel" closewindow="true" id="cancel" />
|
||||
</hbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</window>
|
||||
</gui>
|
||||
|
19
data/widgets/new_folder_window.xml
Normal file
19
data/widgets/new_folder_window.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<!-- ASEPRITE -->
|
||||
<!-- Copyright (C) 2001-2013, 2015 by David Capello -->
|
||||
<gui>
|
||||
<window text="New Folder" id="new_folder_window">
|
||||
<vbox>
|
||||
<hbox>
|
||||
<label text="Folder Name:" />
|
||||
<entry text="New Folder" id="name" maxsize="256" magnet="true" expansive="true" />
|
||||
</hbox>
|
||||
<hbox>
|
||||
<boxfiller />
|
||||
<hbox homogeneous="true">
|
||||
<button text="&OK" closewindow="true" id="ok" magnet="true" width="60" />
|
||||
<button text="&Cancel" closewindow="true" id="cancel" />
|
||||
</hbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</window>
|
||||
</gui>
|
@ -30,6 +30,8 @@
|
||||
#include "base/unique_ptr.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
#include "generated_new_folder_window.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
@ -713,19 +715,13 @@ void FileSelector::onGoUp()
|
||||
|
||||
void FileSelector::onNewFolder()
|
||||
{
|
||||
base::UniquePtr<Window> window(load_widget<Window>("file_selector.xml", "newfolder_dialog"));
|
||||
Button* ok;
|
||||
Entry* name;
|
||||
app::gen::NewFolderWindow window;
|
||||
|
||||
app::finder(window)
|
||||
>> "ok" >> ok
|
||||
>> "name" >> name;
|
||||
|
||||
window->openWindowInForeground();
|
||||
if (window->getKiller() == ok) {
|
||||
window.openWindowInForeground();
|
||||
if (window.getKiller() == window.ok()) {
|
||||
IFileItem* currentFolder = m_fileList->getCurrentFolder();
|
||||
if (currentFolder) {
|
||||
std::string dirname = name->getText();
|
||||
std::string dirname = window.name()->getText();
|
||||
|
||||
// Create the new directory
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user