5 #include "Windows/FileName.h"
\r
8 #include "LangUtils.h"
\r
11 #include "BrowseDialog.h"
\r
12 #include "CopyDialogRes.h"
\r
13 #include "SplitDialog.h"
\r
14 #include "SplitUtils.h"
\r
15 #include "resourceGui.h"
\r
17 using namespace NWindows;
\r
20 static CIDLangPair kIDLangPairs[] =
\r
22 { IDC_STATIC_SPLIT_PATH, 0x03020501 },
\r
23 { IDC_STATIC_SPLIT_VOLUME, 0x02000D40 },
\r
28 bool CSplitDialog::OnInit()
\r
31 LangSetWindowText(HWND(*this), 0x03020500);
\r
32 LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
\r
34 _pathCombo.Attach(GetItem(IDC_COMBO_SPLIT_PATH));
\r
35 _volumeCombo.Attach(GetItem(IDC_COMBO_SPLIT_VOLUME));
\r
37 if (!FilePath.IsEmpty())
\r
45 _pathCombo.SetText(Path);
\r
46 AddVolumeItems(_volumeCombo);
\r
47 _volumeCombo.SetCurSel(0);
\r
49 return CModalDialog::OnInit();
\r
52 bool CSplitDialog::OnSize(WPARAM /* wParam */, int xSize, int ySize)
\r
55 GetMargins(8, mx, my);
\r
57 GetItemSizes(IDCANCEL, bx1, by);
\r
58 GetItemSizes(IDOK, bx2, by);
\r
59 int yPos = ySize - my - by;
\r
60 int xPos = xSize - mx - bx1;
\r
62 InvalidateRect(NULL);
\r
66 GetClientRectOfItem(IDC_BUTTON_SPLIT_PATH, rect);
\r
67 int bx = rect.right - rect.left;
\r
68 MoveItem(IDC_BUTTON_SPLIT_PATH, xSize - mx - bx, rect.top, bx, rect.bottom - rect.top);
\r
69 ChangeSubWindowSizeX(_pathCombo, xSize - mx - mx - bx - mx);
\r
72 MoveItem(IDCANCEL, xPos, yPos, bx1, by);
\r
73 MoveItem(IDOK, xPos - mx - bx2, yPos, bx2, by);
\r
78 bool CSplitDialog::OnButtonClicked(int buttonID, HWND buttonHWND)
\r
82 case IDC_BUTTON_SPLIT_PATH:
\r
86 return CModalDialog::OnButtonClicked(buttonID, buttonHWND);
\r
89 void CSplitDialog::OnButtonSetPath()
\r
91 UString currentPath;
\r
92 _pathCombo.GetText(currentPath);
\r
93 // UString title = L"Specify a location for output folder";
\r
94 UString title = LangStringSpec(IDS_SET_FOLDER, 0x03020209);
\r
97 if (!MyBrowseForFolder(HWND(*this), title, currentPath, resultPath))
\r
99 NFile::NName::NormalizeDirPathPrefix(resultPath);
\r
100 _pathCombo.SetCurSel(-1);
\r
101 _pathCombo.SetText(resultPath);
\r
104 void CSplitDialog::OnOK()
\r
106 _pathCombo.GetText(Path);
\r
107 UString volumeString;
\r
108 _volumeCombo.GetText(volumeString);
\r
109 volumeString.Trim();
\r
110 if (!ParseVolumeSizes(volumeString, VolumeSizes) || VolumeSizes.Size() == 0)
\r
112 ::MessageBoxW(*this, LangString(IDS_INCORRECT_VOLUME_SIZE, 0x02000D41), L"7-Zip", 0);
\r
115 CModalDialog::OnOK();
\r