mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-18 02:42:59 +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>
|
</grid>
|
||||||
</vbox>
|
</vbox>
|
||||||
</window>
|
</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>
|
</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 "base/unique_ptr.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
|
#include "generated_new_folder_window.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
@ -713,19 +715,13 @@ void FileSelector::onGoUp()
|
|||||||
|
|
||||||
void FileSelector::onNewFolder()
|
void FileSelector::onNewFolder()
|
||||||
{
|
{
|
||||||
base::UniquePtr<Window> window(load_widget<Window>("file_selector.xml", "newfolder_dialog"));
|
app::gen::NewFolderWindow window;
|
||||||
Button* ok;
|
|
||||||
Entry* name;
|
|
||||||
|
|
||||||
app::finder(window)
|
window.openWindowInForeground();
|
||||||
>> "ok" >> ok
|
if (window.getKiller() == window.ok()) {
|
||||||
>> "name" >> name;
|
|
||||||
|
|
||||||
window->openWindowInForeground();
|
|
||||||
if (window->getKiller() == ok) {
|
|
||||||
IFileItem* currentFolder = m_fileList->getCurrentFolder();
|
IFileItem* currentFolder = m_fileList->getCurrentFolder();
|
||||||
if (currentFolder) {
|
if (currentFolder) {
|
||||||
std::string dirname = name->getText();
|
std::string dirname = window.name()->getText();
|
||||||
|
|
||||||
// Create the new directory
|
// Create the new directory
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user