aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lluploaddialog.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/lluploaddialog.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/lluploaddialog.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/linden/indra/newview/lluploaddialog.cpp b/linden/indra/newview/lluploaddialog.cpp
index fc58721..14128ee 100644
--- a/linden/indra/newview/lluploaddialog.cpp
+++ b/linden/indra/newview/lluploaddialog.cpp
@@ -78,7 +78,7 @@ LLUploadDialog::LLUploadDialog( const std::string& msg)
78 LLRect msg_rect; 78 LLRect msg_rect;
79 for (int line_num=0; line_num<16; ++line_num) 79 for (int line_num=0; line_num<16; ++line_num)
80 { 80 {
81 mLabelBox[line_num] = new LLTextBox( "Filename", msg_rect, "", font ); 81 mLabelBox[line_num] = new LLTextBox( "Filename", msg_rect, "Filename", font );
82 addChild(mLabelBox[line_num]); 82 addChild(mLabelBox[line_num]);
83 } 83 }
84 84
@@ -100,7 +100,7 @@ void LLUploadDialog::setMessage( const std::string& msg)
100 100
101 // Split message into lines, separated by '\n' 101 // Split message into lines, separated by '\n'
102 S32 max_msg_width = 0; 102 S32 max_msg_width = 0;
103 LLDoubleLinkedList<LLString> msg_lines; 103 std::list<std::string> msg_lines;
104 104
105 S32 size = msg.size() + 1;// + strlen("Uploading...\n\n"); 105 S32 size = msg.size() + 1;// + strlen("Uploading...\n\n");
106 char* temp_msg = new char[size]; 106 char* temp_msg = new char[size];
@@ -118,7 +118,7 @@ void LLUploadDialog::setMessage( const std::string& msg)
118 { 118 {
119 S32 cur_width = S32(font->getWidth(token) + 0.99f) + TEXT_PAD; 119 S32 cur_width = S32(font->getWidth(token) + 0.99f) + TEXT_PAD;
120 max_msg_width = llmax( max_msg_width, cur_width ); 120 max_msg_width = llmax( max_msg_width, cur_width );
121 msg_lines.addDataAtEnd( new LLString( token ) ); 121 msg_lines.push_back( std::string( token ) );
122 token = strtok( NULL, "\n" ); 122 token = strtok( NULL, "\n" );
123 } 123 }
124 delete[] temp_msg; 124 delete[] temp_msg;
@@ -126,33 +126,34 @@ void LLUploadDialog::setMessage( const std::string& msg)
126 126
127 S32 line_height = S32( font->getLineHeight() + 0.99f ); 127 S32 line_height = S32( font->getLineHeight() + 0.99f );
128 S32 dialog_width = max_msg_width + 2 * HPAD; 128 S32 dialog_width = max_msg_width + 2 * HPAD;
129 S32 dialog_height = line_height * msg_lines.getLength() + 2 * VPAD; 129 S32 dialog_height = line_height * msg_lines.size() + 2 * VPAD;
130 130
131 reshape( dialog_width, dialog_height, FALSE ); 131 reshape( dialog_width, dialog_height, FALSE );
132 132
133 // Message 133 // Message
134 S32 msg_x = (mRect.getWidth() - max_msg_width) / 2; 134 S32 msg_x = (getRect().getWidth() - max_msg_width) / 2;
135 S32 msg_y = mRect.getHeight() - VPAD - line_height; 135 S32 msg_y = getRect().getHeight() - VPAD - line_height;
136 int line_num; 136 int line_num;
137 for (line_num=0; line_num<16; ++line_num) 137 for (line_num=0; line_num<16; ++line_num)
138 { 138 {
139 mLabelBox[line_num]->setVisible(FALSE); 139 mLabelBox[line_num]->setVisible(FALSE);
140 } 140 }
141 line_num = 0; 141 line_num = 0;
142 for( LLString* cur_line = msg_lines.getFirstData(); cur_line; cur_line = msg_lines.getNextData() ) 142 for (std::list<std::string>::iterator iter = msg_lines.begin();
143 iter != msg_lines.end(); ++iter)
143 { 144 {
145 std::string& cur_line = *iter;
144 LLRect msg_rect; 146 LLRect msg_rect;
145 msg_rect.setOriginAndSize( msg_x, msg_y, max_msg_width, line_height ); 147 msg_rect.setOriginAndSize( msg_x, msg_y, max_msg_width, line_height );
146 mLabelBox[line_num]->setRect(msg_rect); 148 mLabelBox[line_num]->setRect(msg_rect);
147 mLabelBox[line_num]->setText(*cur_line); 149 mLabelBox[line_num]->setText(cur_line);
148 mLabelBox[line_num]->setColor( gColors.getColor( "LabelTextColor" ) ); 150 mLabelBox[line_num]->setColor( gColors.getColor( "LabelTextColor" ) );
149 mLabelBox[line_num]->setVisible(TRUE); 151 mLabelBox[line_num]->setVisible(TRUE);
150 msg_y -= line_height; 152 msg_y -= line_height;
151 ++line_num; 153 ++line_num;
152 } 154 }
153 msg_lines.deleteAllData();
154 155
155 centerDialog(); 156 centerWithin(gViewerWindow->getRootView()->getRect());
156} 157}
157 158
158LLUploadDialog::~LLUploadDialog() 159LLUploadDialog::~LLUploadDialog()
@@ -165,13 +166,5 @@ LLUploadDialog::~LLUploadDialog()
165 LLUploadDialog::sDialog = NULL; 166 LLUploadDialog::sDialog = NULL;
166} 167}
167 168
168void LLUploadDialog::centerDialog()
169{
170 LLRect window_rect = gViewerWindow->getRootView()->getRect();
171
172 S32 dialog_left = window_rect.mLeft + (window_rect.getWidth() - mRect.getWidth()) / 2;
173 S32 dialog_bottom = window_rect.mBottom + (window_rect.getHeight() - mRect.getHeight()) / 2;
174 169
175 translate( dialog_left - mRect.mLeft, dialog_bottom - mRect.mBottom );
176}
177 170