summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBerk Geveci <berk.geveci@kitware.com>2002-05-01 15:34:27 (GMT)
committerBerk Geveci <berk.geveci@kitware.com>2002-05-01 15:34:27 (GMT)
commitd53458de9ac298344a87d6703de78991d6770832 (patch)
tree7f8c3c274d6bda9633ce82c9ba45e8c632299323
parentd0d25bb989bb0f3db290a2cb935c310aa06ec50b (diff)
downloadCMake-d53458de9ac298344a87d6703de78991d6770832.zip
CMake-d53458de9ac298344a87d6703de78991d6770832.tar.gz
CMake-d53458de9ac298344a87d6703de78991d6770832.tar.bz2
The entry widgets are now created with what is initially available on the terminal.
-rw-r--r--Source/CursesDialog/ccmake.cxx2
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx23
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.h6
-rw-r--r--Source/CursesDialog/cmCursesMainForm.cxx22
-rw-r--r--Source/CursesDialog/cmCursesMainForm.h3
5 files changed, 36 insertions, 20 deletions
diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 5cc5db6..3ee7692 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -117,7 +117,7 @@ int main(int argc, char** argv)
cmCursesMainForm* myform;
- myform = new cmCursesMainForm(args);
+ myform = new cmCursesMainForm(args, x);
cmSystemTools::SetErrorCallback(CMakeErrorHandler);
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
index a4a71bb..8c11aee 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx
@@ -23,19 +23,22 @@
#include "cmCursesDummyWidget.h"
#include "../cmSystemTools.h"
-cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key) :
- m_Key(key)
+cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(const char* key,
+ int labelwidth,
+ int entrywidth) :
+ m_Key(key), m_LabelWidth(labelwidth), m_EntryWidth(entrywidth)
{
- m_Label = new cmCursesLabelWidget(30, 1, 1, 1, key);
+ m_Label = new cmCursesLabelWidget(m_LabelWidth, 1, 1, 1, key);
m_IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, " ");
m_Entry = 0;
}
cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
- const char* key, const cmCacheManager::CacheEntry& value, bool isNew) :
- m_Key(key)
+ const char* key, const cmCacheManager::CacheEntry& value, bool isNew,
+ int labelwidth, int entrywidth)
+ : m_Key(key), m_LabelWidth(labelwidth), m_EntryWidth(entrywidth)
{
- m_Label = new cmCursesLabelWidget(30, 1, 1, 1, key);
+ m_Label = new cmCursesLabelWidget(m_LabelWidth, 1, 1, 1, key);
if (isNew)
{
m_IsNewLabel = new cmCursesLabelWidget(1, 1, 1, 1, "*");
@@ -49,7 +52,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
switch ( value.m_Type )
{
case cmCacheManager::BOOL:
- m_Entry = new cmCursesBoolWidget(30, 1, 1, 1);
+ m_Entry = new cmCursesBoolWidget(m_EntryWidth, 1, 1, 1);
if (cmSystemTools::IsOn(value.m_Value.c_str()))
{
static_cast<cmCursesBoolWidget*>(m_Entry)->SetValueAsBool(true);
@@ -60,17 +63,17 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite(
}
break;
case cmCacheManager::PATH:
- m_Entry = new cmCursesPathWidget(30, 1, 1, 1);
+ m_Entry = new cmCursesPathWidget(m_EntryWidth, 1, 1, 1);
static_cast<cmCursesPathWidget*>(m_Entry)->SetString(
value.m_Value.c_str());
break;
case cmCacheManager::FILEPATH:
- m_Entry = new cmCursesFilePathWidget(30, 1, 1, 1);
+ m_Entry = new cmCursesFilePathWidget(m_EntryWidth, 1, 1, 1);
static_cast<cmCursesFilePathWidget*>(m_Entry)->SetString(
value.m_Value.c_str());
break;
case cmCacheManager::STRING:
- m_Entry = new cmCursesStringWidget(30, 1, 1, 1);
+ m_Entry = new cmCursesStringWidget(m_EntryWidth, 1, 1, 1);
static_cast<cmCursesStringWidget*>(m_Entry)->SetString(
value.m_Value.c_str());
break;
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.h b/Source/CursesDialog/cmCursesCacheEntryComposite.h
index 1d55433..2145d1c 100644
--- a/Source/CursesDialog/cmCursesCacheEntryComposite.h
+++ b/Source/CursesDialog/cmCursesCacheEntryComposite.h
@@ -23,10 +23,10 @@
class cmCursesCacheEntryComposite
{
public:
- cmCursesCacheEntryComposite(const char* key);
+ cmCursesCacheEntryComposite(const char* key, int labelwidth, int entrywidth);
cmCursesCacheEntryComposite(const char* key,
const cmCacheManager::CacheEntry& value,
- bool isNew);
+ bool isNew, int labelwidth, int entrywidth);
~cmCursesCacheEntryComposite();
const char* GetValue();
@@ -40,6 +40,8 @@ protected:
cmCursesLabelWidget* m_IsNewLabel;
cmCursesWidget* m_Entry;
std::string m_Key;
+ int m_LabelWidth;
+ int m_EntryWidth;
};
#endif // __cmCursesCacheEntryComposite_h
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx
index 503dc58..94a5747 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -33,8 +33,9 @@ inline int ctrl(int z)
return (z&037);
}
-cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args) :
- m_Args(args)
+cmCursesMainForm::cmCursesMainForm(std::vector<std::string> const& args,
+ int initWidth) :
+ m_Args(args), m_InitialWidth(initWidth)
{
m_NumberOfPages = 0;
m_Fields = 0;
@@ -116,12 +117,14 @@ void cmCursesMainForm::InitializeUI()
}
}
+ int entrywidth = m_InitialWidth - 35;
+
cmCursesCacheEntryComposite* comp;
if ( count == 0 )
{
// If cache is empty, display a label saying so and a
// dummy entry widget (does not respond to input)
- comp = new cmCursesCacheEntryComposite("EMPTY CACHE");
+ comp = new cmCursesCacheEntryComposite("EMPTY CACHE", 30, 30);
comp->m_Entry = new cmCursesDummyWidget(1, 1, 1, 1);
newEntries->push_back(comp);
}
@@ -144,7 +147,8 @@ void cmCursesMainForm::InitializeUI()
if (!this->LookForCacheEntry(key))
{
newEntries->push_back(new cmCursesCacheEntryComposite(key, value,
- true));
+ true, 30,
+ entrywidth));
m_OkToGenerate = false;
}
}
@@ -164,7 +168,8 @@ void cmCursesMainForm::InitializeUI()
if (this->LookForCacheEntry(key))
{
newEntries->push_back(new cmCursesCacheEntryComposite(key, value,
- false));
+ false, 30,
+ entrywidth));
}
}
}
@@ -266,6 +271,7 @@ void cmCursesMainForm::Render(int left, int top, int width, int height)
// Wrong window size
if ( width < cmCursesMainForm::MIN_WIDTH ||
+ width < m_InitialWidth ||
height < cmCursesMainForm::MIN_HEIGHT )
{
return;
@@ -337,6 +343,7 @@ void cmCursesMainForm::PrintKeys()
int x,y;
getmaxyx(stdscr, y, x);
if ( x < cmCursesMainForm::MIN_WIDTH ||
+ x < m_InitialWidth ||
y < cmCursesMainForm::MIN_HEIGHT )
{
return;
@@ -405,12 +412,15 @@ void cmCursesMainForm::UpdateStatusBar()
getmaxyx(stdscr, y, x);
// If window size is too small, display error and return
if ( x < cmCursesMainForm::MIN_WIDTH ||
+ x < m_InitialWidth ||
y < cmCursesMainForm::MIN_HEIGHT )
{
curses_clear();
curses_move(0,0);
printw("Window is too small. A size of at least %dx%d is required.",
- cmCursesMainForm::MIN_WIDTH, cmCursesMainForm::MIN_HEIGHT);
+ (cmCursesMainForm::MIN_WIDTH < m_InitialWidth ?
+ m_InitialWidth : cmCursesMainForm::MIN_WIDTH),
+ cmCursesMainForm::MIN_HEIGHT);
touchwin(stdscr);
wrefresh(stdscr);
return;
diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h
index 3a15f58..56bd6de 100644
--- a/Source/CursesDialog/cmCursesMainForm.h
+++ b/Source/CursesDialog/cmCursesMainForm.h
@@ -31,7 +31,7 @@ class cmCursesCacheEntryComposite;
class cmCursesMainForm : public cmCursesForm
{
public:
- cmCursesMainForm(std::vector<std::string> const& args);
+ cmCursesMainForm(std::vector<std::string> const& args, int initwidth);
virtual ~cmCursesMainForm();
/**
@@ -129,6 +129,7 @@ protected:
// Number of pages displayed
int m_NumberOfPages;
+ int m_InitialWidth;
};
#endif // __cmCursesMainForm_h