• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂11411bfdf86affd4ee794fc31eaaf95cadecc649 (tree)
時間2012-10-29 21:19:41
作者angeart <angeart@git....>
Commiterangeart

Log Message

コピペ機能を復活
カメラに影響する問題を修正

Change Summary

差異

--- a/client/tlsf.cpp
+++ b/client/tlsf.cpp
@@ -955,17 +955,51 @@ void* tlsf_realloc(tlsf_pool tlsf, void* ptr, size_t size)
955955 return p;
956956 }
957957
958+#include <map>
959+static std::map<int,int> tlsf_addresses;
960+
958961 void * tlsf_new(tlsf_pool mempool,size_t size){
959962 void *p = tlsf_malloc(mempool,size);
960963 if(!p){
961964 std::bad_alloc b;
962965 throw b;
963966 }
967+ TCHAR tmp[32],str[128];
968+ _itot_s((int)p,tmp,10);
969+ _tcscpy_s(str,L"tlsf new address : ");
970+ _tcscat_s(str,tmp);
971+ _tcscat_s(str,L"\r\n");
972+ OutputDebugString(str);
973+ tlsf_addresses.insert(std::make_pair<int,int>((int)p,size));
964974 return p;
965975 }
966976
967977
968978 void tlsf_delete(tlsf_pool mempool,void *p)
969979 {
980+ TCHAR tmp[32],str[128];
981+ _itot_s((int)p,tmp,10);
982+ _tcscpy_s(str,L"tlsf delete address : ");
983+ _tcscat_s(str,tmp);
984+ _tcscat_s(str,L"\r\n");
985+ OutputDebugString(str);
986+ auto it = tlsf_addresses.find((int)p);
987+ tlsf_addresses.erase(it);
970988 if(p)tlsf_free(mempool,p);
971989 }
990+
991+void output_tlsf_leak()
992+{
993+ for(auto it = tlsf_addresses.begin();it != tlsf_addresses.end();++it)
994+ {
995+ TCHAR tmp[32],str[128];
996+ _itot_s(it->first,tmp,10);
997+ _tcscpy_s(str,L"leak address : ");
998+ _tcscat_s(str,tmp);
999+ _itot_s(it->second,tmp,10);
1000+ _tcscat_s(str,L"\tsize : ");
1001+ _tcscat_s(str,tmp);
1002+ _tcscat_s(str,L"\r\n");
1003+ OutputDebugString(str);
1004+ }
1005+}
\ No newline at end of file
--- a/client/tlsf.h
+++ b/client/tlsf.h
@@ -51,6 +51,7 @@ size_t tlsf_overhead();
5151
5252 void *tlsf_new(tlsf_pool mempool,size_t size);
5353 void tlsf_delete(tlsf_pool mempool,void *p);
54+void output_tlsf_leak();
5455
5556 template<typename T>
5657 T *tlsf_new(tlsf_pool mempool,size_t size){
--- a/client/ui/Input.cpp
+++ b/client/ui/Input.cpp
@@ -8,7 +8,7 @@
88
99 const size_t Input::TEXT_BUFFER_SIZE = 1024;
1010 const size_t Input::HISTORY_MAX_SIZE = 50;
11-const int Input::KEY_REPEAT_FRAME = 6;
11+const int Input::KEY_REPEAT_FRAME = 8;
1212
1313 const int Input::INPUT_MARGIN_X = 8;
1414 const int Input::INPUT_MARGIN_Y = 6;
@@ -19,9 +19,12 @@ const int Input::IME_MARGIN_Y = 16;
1919 const int Input::IME_MAX_PAGE_SIZE = 6;
2020 const int Input::IME_MIN_WIDTH = 120;
2121
22-Input::Input() :
22+Input::Input(ConfigManagerPtr config_manager) :
2323 multiline_(true),
24- reverse_color_(false)
24+ reverse_color_(false),
25+ drag_flag_(false),
26+ rightmenu_show_(false),
27+ config_manager_(config_manager)
2528 {
2629 input_bg_image_handle_ = ResourceManager::LoadCachedDivGraph<4>(
2730 _T("system/images/gui/gui_inputbox_input_bg.png"), 2, 2, 12, 12);
@@ -45,6 +48,114 @@ Input::Input() :
4548 y_ = 100;
4649 width_ = 160;
4750 height_ = font_height_ + 4;
51+
52+ click_cancel_count_ = 0;
53+
54+}
55+
56+void Input::Init()
57+{
58+ auto shd_right_click_list_ = std::make_shared<UIList>(right_click_list_);
59+ right_click_list_.addItem(UIBasePtr(new UILabel([&]()->UILabel{
60+ UILabel label;
61+ label.set_parent_c(shd_right_click_list_);
62+ label.set_input_adaptor(this);
63+ label.set_text(unicode::ToTString(unicode::sjis2utf8("切り取り")));
64+ label.set_width(120);
65+ label.set_top(12);
66+ label.set_left(0);
67+ label.set_textcolor(UISuper::Color(0,0,0,255));
68+ label.set_bgcolor(UISuper::Color(255,255,255,180));
69+ label.set_on_click_function_([](UIBase* ptr)->void{
70+ auto input_ = ptr->input_adpator();
71+ auto sel_txt = input_->selecting_text();
72+ SetClipboardText(sel_txt.c_str());
73+ auto text = input_->text();
74+ auto pos = text.find(sel_txt);
75+ tstring res;
76+ if( pos != std::string::npos )
77+ {
78+ res = text.substr(0,pos);
79+ res += text.substr(pos + sel_txt.size(),text.size() - pos + sel_txt.size());
80+ }
81+ input_->set_text(res);
82+ input_->set_click_chancel_count(8);
83+ });
84+ label.set_on_hover_function_([](UIBase* ptr)->void{
85+ auto label_ptr = (UILabel *)ptr;
86+ label_ptr->set_bgcolor(UISuper::Color(0,0,0,180));
87+ label_ptr->set_textcolor(UISuper::Color(255,255,255));
88+ });
89+ label.set_on_out_function_([](UIBase* ptr)->void{
90+ auto label_ptr = (UILabel *)ptr;
91+ label_ptr->set_bgcolor(UISuper::Color(255,255,255,180));
92+ label_ptr->set_textcolor(UISuper::Color(0,0,0));
93+ });
94+ return label;
95+ }())));
96+ right_click_list_.addItem(UIBasePtr(new UILabel([&]()->UILabel{
97+ UILabel label;
98+ label.set_parent_c(shd_right_click_list_);
99+ label.set_input_adaptor(this);
100+ label.set_text(unicode::ToTString(unicode::sjis2utf8("コピー")));
101+ label.set_width(120);
102+ label.set_top(12);
103+ label.set_left(0);
104+ label.set_textcolor(UISuper::Color(0,0,0,255));
105+ label.set_bgcolor(UISuper::Color(255,255,255,180));
106+ label.set_on_click_function_([&](UIBase* ptr)->void{
107+ auto input_ = ptr->input_adpator();
108+ SetClipboardText(input_->selecting_text().c_str());
109+ input_->set_click_chancel_count(8);
110+ });
111+ label.set_on_hover_function_([](UIBase* ptr)->void{
112+ auto label_ptr = (UILabel *)ptr;
113+ label_ptr->set_bgcolor(UISuper::Color(0,0,0,180));
114+ label_ptr->set_textcolor(UISuper::Color(255,255,255));
115+ });
116+ label.set_on_out_function_([](UIBase* ptr)->void{
117+ auto label_ptr = (UILabel *)ptr;
118+ label_ptr->set_bgcolor(UISuper::Color(255,255,255,180));
119+ label_ptr->set_textcolor(UISuper::Color(0,0,0));
120+ });
121+ return label;
122+ }())));
123+ right_click_list_.addItem(UIBasePtr(new UILabel([&]()->UILabel{
124+ UILabel label;
125+ label.set_parent_c(shd_right_click_list_);
126+ label.set_input_adaptor(this);
127+ label.set_text(unicode::ToTString(unicode::sjis2utf8("貼り付け")));
128+ label.set_width(120);
129+ label.set_top(12);
130+ label.set_left(0);
131+ label.set_textcolor(UISuper::Color(0,0,0,255));
132+ label.set_bgcolor(UISuper::Color(255,255,255,180));
133+ label.set_on_click_function_([&](UIBase* ptr)->void{
134+ auto input_ = ptr->input_adpator();
135+ auto size = GetClipboardText(NULL);
136+ if(size > 0){
137+ TCHAR *buf = new TCHAR[size];
138+ GetClipboardText(buf);
139+ input_->paste_text(buf);
140+ delete []buf;
141+ }
142+ input_->set_click_chancel_count(8);
143+ });
144+ label.set_on_hover_function_([](UIBase* ptr)->void{
145+ auto label_ptr = (UILabel *)ptr;
146+ label_ptr->set_bgcolor(UISuper::Color(0,0,0,180));
147+ label_ptr->set_textcolor(UISuper::Color(255,255,255));
148+ });
149+ label.set_on_out_function_([](UIBase* ptr)->void{
150+ auto label_ptr = (UILabel *)ptr;
151+ label_ptr->set_bgcolor(UISuper::Color(255,255,255,180));
152+ label_ptr->set_textcolor(UISuper::Color(0,0,0));
153+ });
154+ return label;
155+ }())));
156+ right_click_list_.set_height((font_height_ + 2)* 3);
157+ right_click_list_.set_width(120);
158+ right_click_list_.set_visible(false);
48159 }
49160
50161 void Input::Draw()
@@ -159,12 +270,98 @@ void Input::Draw()
159270 }
160271 }
161272
162- for (auto it = lines_.begin(); it != lines_.end(); ++it) {
163- auto line = *it;
164- DrawStringToHandle(internal_x, internal_y + current_line * font_height_,
165- line.c_str(), text_color, font_handle_);
166- current_line++;
167- }
273+ int select_start = 0,select_end = 0;
274+ GetKeyInputSelectArea(&select_start,&select_end,input_handle_);
275+ if( select_start > select_end )std::swap(select_start,select_end);
276+
277+ if( select_start > -1 && select_end != select_start ) {
278+ if ( multiline_ ) {
279+ BOOST_FOREACH(auto it,lines_){
280+ int width = 0;
281+ TCHAR c[2] = {0};
282+ if( select_start >= it.size() && select_start != -1 ) {
283+ DrawStringToHandle(internal_x, internal_y + current_line * font_height_,
284+ it.c_str(), text_color, font_handle_);
285+ if(select_start == it.size()){
286+ select_start -= it.size();
287+ }else{
288+ select_start -= it.size() + 1;
289+ }
290+ select_end -= it.size() + 1;
291+ ++current_line;
292+ }else if(select_start != -1){
293+ for(int i = 0;i < select_start;++i){
294+ c[0] = it[i];
295+ DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_,
296+ c, text_color, font_handle_);
297+ width += GetDrawStringWidthToHandle(c,1,font_handle_);
298+ }
299+ for(int i = select_start;i < ((select_end > static_cast<int>(it.size())) ? it.size() : select_end); ++i){
300+ c[0] = it[i];
301+ SetDrawBlendMode(DX_BLENDMODE_ALPHA, 180);
302+ DrawBox(internal_x + width,internal_y + current_line * font_height_,
303+ internal_x + width + GetDrawStringWidthToHandle(c,1,font_handle_),internal_y + ( current_line + 1 ) * font_height_,text_color,1);
304+ DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_,
305+ c, !reverse_color_ ? GetColor(255, 255, 255) : GetColor(0, 0, 0), font_handle_);
306+ width += GetDrawStringWidthToHandle(c,1,font_handle_);
307+ SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
308+ }
309+ for(int i = ((select_end > static_cast<int>(it.size())) ? it.size() : select_end);i < it.size(); ++i){
310+ c[0] = it[i];
311+ DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_,
312+ c, text_color, font_handle_);
313+ width += GetDrawStringWidthToHandle(c,1,font_handle_);
314+ }
315+ if(select_end > it.size()){
316+ select_end -= it.size() + 1;
317+ select_start = 0;
318+ }else{
319+ select_start = -1;
320+ }
321+ ++current_line;
322+ }else if(select_start == -1){
323+ DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_,
324+ it.c_str(), text_color, font_handle_);
325+ ++current_line;
326+ }
327+ }
328+ }else{
329+ BOOST_FOREACH(auto it,lines_){
330+ int width = 0;
331+ TCHAR c[2] = {0};
332+ for(int i = 0;i < select_start;++i){
333+ c[0] = it[i];
334+ DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_,
335+ c, text_color, font_handle_);
336+ width += GetDrawStringWidthToHandle(c,1,font_handle_);
337+ }
338+ for(int i = select_start;i < select_end; ++i){
339+ c[0] = it[i];
340+ SetDrawBlendMode(DX_BLENDMODE_ALPHA, 180);
341+ DrawBox(internal_x + width,internal_y + current_line * font_height_,
342+ internal_x + width + GetDrawStringWidthToHandle(c,1,font_handle_),internal_y + ( current_line + 1 ) * font_height_,text_color,1);
343+ DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_,
344+ c, !reverse_color_ ? GetColor(255, 255, 255) : GetColor(0, 0, 0), font_handle_);
345+ width += GetDrawStringWidthToHandle(c,1,font_handle_);
346+ SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
347+ }
348+ for(unsigned int i = select_end;i < it.size(); ++i){
349+ c[0] = it[i];
350+ DrawStringToHandle(internal_x + width, internal_y + current_line * font_height_,
351+ c, text_color, font_handle_);
352+ width += GetDrawStringWidthToHandle(c,1,font_handle_);
353+ }
354+ }
355+ }
356+ }else{
357+ for (auto it = lines_.begin(); it != lines_.end(); ++it) {
358+ auto line = *it;
359+ DrawStringToHandle(internal_x, internal_y + current_line * font_height_,
360+ line.c_str(), text_color, font_handle_);
361+ current_line++;
362+ }
363+ }
364+
168365
169366 // カーソルを描画
170367 if (clause_lines_.size() <= 0 && active() && blink_count_ < 30) {
@@ -258,11 +455,21 @@ void Input::Draw()
258455 }
259456 }
260457 }
458+ {
459+ if ( right_click_list_.visible() ) {
460+ right_click_list_.Draw();
461+ }
462+ }
261463 }
262464
263465 void Input::Update()
264466 {
265467 blink_count_ = (blink_count_ + 1) % 60;
468+ {
469+ if ( right_click_list_.visible() ) {
470+ right_click_list_.Update();
471+ }
472+ }
266473 }
267474
268475 void Input::ProcessInput(InputManager* input)
@@ -271,7 +478,18 @@ void Input::ProcessInput(InputManager* input)
271478 return;
272479 }
273480
274- // bool push_mouse_left = (input->GetMouseLeftCount() > 0);
481+ if (click_cancel_count_ > 0)
482+ {
483+ input->CancelMouseLeft();
484+ input->CancelMouseRight();
485+ --click_cancel_count_;
486+ }
487+
488+ bool push_mouse_left = (input->GetMouseLeftCount() > 0);
489+ bool prev_mouse_left = input->GetPrevMouseLeft();
490+
491+ bool push_mouse_right = (input->GetMouseRightCount() > 0);
492+ bool prev_mouse_right = input->GetPrevMouseRight();
275493
276494 // bool first_key_shift = (input->GetKeyCount(KEY_INPUT_RSHIFT) == 1
277495 // || input->GetKeyCount(KEY_INPUT_LSHIFT) == 1);
@@ -292,6 +510,7 @@ void Input::ProcessInput(InputManager* input)
292510 + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0;
293511 bool push_repeat_key_down = (input->GetKeyCount(KEY_INPUT_DOWN)
294512 + KEY_REPEAT_FRAME) % (KEY_REPEAT_FRAME + 1) == 0;
513+
295514 // bool push_long_backspace = (input->GetKeyCount(KEY_INPUT_BACK) > 60 * 1.5);
296515
297516 auto input_text = text();
@@ -312,6 +531,13 @@ void Input::ProcessInput(InputManager* input)
312531 }
313532 }
314533
534+ if ( right_click_list_.visible() ) {
535+ right_click_list_.ProcessInput(input);
536+ if( push_mouse_left ) {
537+ //rightmenu_show_ = false;
538+ right_click_list_.set_visible(false);
539+ }
540+ }
315541 if (push_repeat_key_up) {
316542 cursor_moveto_y_ = cursor_y_ - font_height_ / 2;
317543 cursor_moveto_x_ = cursor_x_ + 2;
@@ -407,7 +633,189 @@ void Input::ProcessInput(InputManager* input)
407633 }
408634
409635 if (active()) {
410- // カーソル位置(byte)を取得
636+ if ( !right_click_list_.visible() &&
637+ !( right_click_list_.visible() && right_click_list_.absolute_x()<= input->GetMouseX() && input->GetMouseX() <= right_click_list_.absolute_x()+ right_click_list_.absolute_width()
638+ && right_click_list_.absolute_y() <= input->GetMouseY() && input->GetMouseY() <= right_click_list_.absolute_y() + right_click_list_.absolute_height())) {
639+ // マウス左ボタンが押された時
640+ if (push_mouse_left && !prev_mouse_left) {
641+ auto mpos = input->GetMousePos();
642+ auto offset_x = mpos.first - (x_ + INPUT_MARGIN_X);
643+ auto offset_y = mpos.second - (y_ + INPUT_MARGIN_Y);
644+ // カレット変更
645+ if( multiline_ ) {
646+ auto line_num = offset_y / font_height_;
647+ //if( ( offset_y % font_height_ ) != 0 )++line_num;
648+ int tmp = 0,cnt = 0;
649+ if( line_num < (int)lines_.size() && line_num >= 0 ){
650+ for(int i = 0;i < line_num; ++i){
651+ cnt += lines_[i].size();
652+ }
653+ for(unsigned int i = 0;i < lines_[line_num].size(); ++i){
654+ auto tmp_x = GetDrawStringWidthToHandle(&lines_[line_num][i],1,font_handle_);
655+ if( tmp + tmp_x < offset_x ){
656+ tmp += tmp_x;
657+ ++cnt;
658+ }
659+ }
660+ SetKeyInputCursorPosition(line_num + cnt,input_handle_);
661+ }
662+ }else{
663+ int tmp = 0,cnt = 0;
664+ for(unsigned int i = 0;i < lines_[0].size(); ++i){
665+ auto tmp_x = GetDrawStringWidthToHandle(&lines_[0][i],1,font_handle_);
666+ if( tmp + tmp_x < offset_x ){
667+ tmp += tmp_x;
668+ ++cnt;
669+ }
670+ }
671+ if( selecting_coursorpoint_.first = selecting_coursorpoint_.second ) {
672+ SetKeyInputSelectArea( -1, -1, input_handle_ );
673+ }else{
674+ SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_);
675+ }
676+ SetKeyInputCursorPosition(cnt,input_handle_);
677+ }
678+ }
679+ // マウス左ボタンがドラッグされた時
680+ if (push_mouse_left && prev_mouse_left ) {
681+ int prev_cursor_pos = 0;
682+ if( !drag_flag_ ){
683+ prev_cursor_pos = GetKeyInputCursorPosition(input_handle_);
684+ }else{
685+ prev_cursor_pos = selecting_coursorpoint_.first;
686+ }
687+ auto mpos = input->GetMousePos();
688+ auto offset_x = mpos.first - (x_ + INPUT_MARGIN_X);
689+ auto offset_y = mpos.second - (y_ + INPUT_MARGIN_Y);
690+ // カレット変更
691+ if( multiline_ ) {
692+ auto line_num = offset_y / font_height_;
693+ int tmp = 0,cnt = 0;
694+ if( line_num < (int)lines_.size() && line_num >= 0){
695+ for(int i = 0;i < line_num; ++i,++cnt){
696+ cnt += lines_[i].size();
697+ }
698+ for(unsigned int i = 0;i < lines_[line_num].size(); ++i){
699+ auto tmp_x = GetDrawStringWidthToHandle(&lines_[line_num][i],1,font_handle_);
700+ if( tmp + tmp_x < offset_x ){
701+ tmp += tmp_x;
702+ ++cnt;
703+ }
704+ }
705+ }
706+ selecting_coursorpoint_ = std::make_pair<int,int>(prev_cursor_pos,cnt);
707+ }else{
708+ int tmp = 0,cnt = 0;
709+ for(unsigned int i = 0;i < lines_[0].size(); ++i){
710+ auto tmp_x = GetDrawStringWidthToHandle(&lines_[0][i],1,font_handle_);
711+ if( tmp + tmp_x < offset_x ){
712+ tmp += tmp_x;
713+ ++cnt;
714+ }
715+ }
716+ selecting_coursorpoint_ = std::make_pair<int,int>(prev_cursor_pos,cnt);
717+ }
718+ SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_);
719+ SetKeyInputCursorPosition(selecting_coursorpoint_.second,input_handle_);
720+ drag_flag_ = true;
721+ }
722+ // マウス左ボタンが離され、且つ前回ドラッグされていた時
723+ if (!push_mouse_left && prev_mouse_left && drag_flag_ ) {
724+ drag_flag_ = false;
725+ if( selecting_coursorpoint_.first == selecting_coursorpoint_.second ) {
726+ SetKeyInputSelectArea( -1, -1, input_handle_ );
727+ }else{
728+ if(selecting_coursorpoint_.first > selecting_coursorpoint_.second)
729+ {
730+ std::swap(selecting_coursorpoint_.first , selecting_coursorpoint_.second);
731+ }
732+ SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_);
733+ }
734+ SetKeyInputCursorPosition(selecting_coursorpoint_.second,input_handle_);
735+ }
736+ }else{
737+ if( push_mouse_left ){
738+ auto mpos = input->GetMousePos();
739+ auto offset_x = mpos.first - (x_ + INPUT_MARGIN_X);
740+ auto offset_y = mpos.second - (y_ + INPUT_MARGIN_Y);
741+ // カレット変更
742+ if( multiline_ ) {
743+ auto line_num = offset_y / font_height_;
744+ //if( ( offset_y % font_height_ ) != 0 )++line_num;
745+ int tmp = 0,cnt = 0;
746+ if( line_num < (int)lines_.size() && line_num >= 0 ){
747+ for(int i = 0;i < line_num; ++i){
748+ cnt += lines_[i].size();
749+ }
750+ for(unsigned int i = 0;i < lines_[line_num].size(); ++i){
751+ auto tmp_x = GetDrawStringWidthToHandle(&lines_[line_num][i],1,font_handle_);
752+ if( tmp + tmp_x < offset_x ){
753+ tmp += tmp_x;
754+ ++cnt;
755+ }
756+ }
757+ SetKeyInputCursorPosition(line_num + cnt,input_handle_);
758+ }
759+ }else{
760+ int tmp = 0,cnt = 0;
761+ for(unsigned int i = 0;i < lines_[0].size(); ++i){
762+ auto tmp_x = GetDrawStringWidthToHandle(&lines_[0][i],1,font_handle_);
763+ if( tmp + tmp_x < offset_x ){
764+ tmp += tmp_x;
765+ ++cnt;
766+ }
767+ }
768+ if( selecting_coursorpoint_.first = selecting_coursorpoint_.second ) {
769+ SetKeyInputSelectArea( -1, -1, input_handle_ );
770+ }else{
771+ SetKeyInputSelectArea(selecting_coursorpoint_.first,selecting_coursorpoint_.second,input_handle_);
772+ }
773+ SetKeyInputCursorPosition(cnt,input_handle_);
774+ }
775+ }
776+ }
777+ // マウス右ボタンが押されたとき
778+ if ( push_mouse_right && !prev_mouse_right ) {
779+ if( x() <= input->GetMouseX() && input->GetMouseX() <= x() + width() &&
780+ y() <= input->GetMouseY() && input->GetMouseY() <= y() + height()){
781+ auto mouse_pos_ = input->GetMousePos();
782+ if( mouse_pos_.second + right_click_list_.absolute_height() > config_manager_->screen_height()){
783+ right_click_list_.set_top(mouse_pos_.second - right_click_list_.absolute_height());
784+ if ( mouse_pos_.first + right_click_list_.absolute_width() > config_manager_->screen_width()){
785+ right_click_list_.set_left(mouse_pos_.first - right_click_list_.absolute_width());
786+ BOOST_FOREACH(auto it,right_click_list_.getItems()){
787+ it->set_left(mouse_pos_.first - right_click_list_.absolute_width());
788+ it->set_top(mouse_pos_.second - right_click_list_.absolute_height() + 12);
789+ }
790+ }else{
791+ right_click_list_.set_left(mouse_pos_.first);
792+ BOOST_FOREACH(auto it,right_click_list_.getItems()){
793+ it->set_left(mouse_pos_.first);
794+ it->set_top(mouse_pos_.second - right_click_list_.absolute_height() + 12);
795+ }
796+ }
797+ }else{
798+ right_click_list_.set_top(mouse_pos_.second);
799+ if ( mouse_pos_.first + right_click_list_.absolute_width() > config_manager_->screen_width()){
800+ right_click_list_.set_left(mouse_pos_.first - right_click_list_.absolute_width());
801+ BOOST_FOREACH(auto it,right_click_list_.getItems()){
802+ it->set_left(mouse_pos_.first - right_click_list_.absolute_width());
803+ it->set_top(mouse_pos_.second + 12);
804+ }
805+ }else{
806+ right_click_list_.set_left(mouse_pos_.first);
807+ BOOST_FOREACH(auto it,right_click_list_.getItems()){
808+ it->set_left(mouse_pos_.first);
809+ it->set_top(mouse_pos_.second + 12);
810+ }
811+ }
812+ }
813+ right_click_list_.set_visible(true);
814+ //rightmenu_show_ = true;
815+ }
816+ }
817+
818+ // カーソル位置(文字単位)を取得
411819 cursor_byte_pos = GetKeyInputCursorPosition(input_handle_);
412820 if (prev_cursor_pos_ != cursor_byte_pos) {
413821 ResetCursorCount();
@@ -415,6 +823,7 @@ void Input::ProcessInput(InputManager* input)
415823
416824 prev_cursor_pos_ = cursor_byte_pos;
417825
826+
418827 // カーソルのドット単位の位置を取得する
419828 cursor_dot_pos = GetDrawStringWidthToHandle(String, cursor_byte_pos,
420829 font_handle_);
@@ -621,6 +1030,7 @@ void Input::ProcessInput(InputManager* input)
6211030 TCHAR c = *it;
6221031 int width = GetDrawStringWidthToHandle(&c, 1, font_handle_);
6231032 line_buffer += tstring(&c, 1);
1033+ char_count++;
6241034 #else
6251035 unsigned char c = *it;
6261036 TCHAR string[2] = { 0, 0 };
@@ -659,7 +1069,7 @@ void Input::ProcessInput(InputManager* input)
6591069 && cursor_moveto_x_ <= line_width + width
6601070 && static_cast<int>(lines_.size() + message_lines_.size()) * font_height_ <= cursor_moveto_y_
6611071 && cursor_moveto_y_ <= (static_cast<int>(lines_.size() + message_lines_.size()) + 1) * font_height_) {
662- SetKeyInputCursorPosition(prev_char_count, input_handle_);
1072+ SetKeyInputCursorPosition(char_count - 1, input_handle_);
6631073 cursor_moveto_x_ = -1;
6641074 cursor_moveto_y_ = -1;
6651075 }
@@ -716,6 +1126,7 @@ void Input::ProcessInput(InputManager* input)
7161126 if (active()) {
7171127 input->CancelKeyCountAll();
7181128 }
1129+
7191130 }
7201131
7211132 bool Input::active()
@@ -815,6 +1226,51 @@ void Input::set_on_enter(const CallbackFunc& func)
8151226 on_enter_ = func;
8161227 }
8171228
1229+tstring Input::selecting_text() const
1230+{
1231+ int select_start = 0,select_end = 0;
1232+ GetKeyInputSelectArea(&select_start,&select_end,input_handle_);
1233+ if( select_start > select_end )std::swap(select_start,select_end);
1234+ tstring selecting_text;
1235+
1236+ if( select_start > -1 && select_end != select_start ) {
1237+ if ( multiline_ ) {
1238+ BOOST_FOREACH(auto it,lines_){
1239+ TCHAR c[2] = {0};
1240+ if( select_start > it.size() && select_start != -1 ) {
1241+ select_start -= it.size();
1242+ select_end -= it.size();
1243+ }else{
1244+ for(int i = select_start;i < select_end; ++i){
1245+ c[0] = it[i];
1246+ selecting_text += c;
1247+ }
1248+ select_start = -1;
1249+ }
1250+ }
1251+ }else{
1252+ BOOST_FOREACH(auto it,lines_){
1253+ TCHAR c[2] = {0};
1254+ for(int i = select_start;i < select_end; ++i){
1255+ c[0] = it[i];
1256+ selecting_text += c;
1257+ }
1258+ }
1259+ }
1260+ }
1261+ return selecting_text;
1262+}
1263+
1264+void Input::paste_text(tstring text)
1265+{
1266+ auto pos = GetKeyInputCursorPosition(input_handle_);
1267+ TCHAR String[TEXT_BUFFER_SIZE];
1268+ GetKeyInputString(String, input_handle_);
1269+ tstring dat(String, _tcslen(String));
1270+ dat.insert(pos,text);
1271+ SetKeyInputString(dat.c_str(), input_handle_);
1272+}
1273+
8181274 bool Input::reverse_color() const
8191275 {
8201276 return reverse_color_;
@@ -833,4 +1289,9 @@ bool Input::multiline() const
8331289 void Input::set_multiline(bool flag)
8341290 {
8351291 multiline_ = flag;
1292+}
1293+
1294+void Input::set_click_chancel_count(int count)
1295+{
1296+ click_cancel_count_ = count;
8361297 }
\ No newline at end of file
--- a/client/ui/Input.hpp
+++ b/client/ui/Input.hpp
@@ -8,16 +8,20 @@
88 #include <functional>
99 #include "../ResourceManager.hpp"
1010 #include "../InputManager.hpp"
11+#include "../ConfigManager.hpp"
12+#include "include.hpp"
13+#include <boost/enable_shared_from_this.hpp>
1114
12-class Input {
15+class Input{
1316 typedef std::function<bool(const std::string&)> CallbackFunc;
1417
1518 public:
16- Input();
19+ Input(ConfigManagerPtr config_manager);
1720
1821 void Draw();
1922 void Update();
2023 void ProcessInput(InputManager* input);
24+ void Init();
2125
2226 bool active();
2327 void set_active(bool flag);
@@ -45,6 +49,11 @@ class Input {
4549
4650 void set_on_enter(const CallbackFunc& func);
4751
52+ tstring selecting_text() const;
53+ void paste_text(tstring text);
54+
55+ void set_click_chancel_count(int count);
56+
4857 public:
4958 void CancelSelect();
5059
@@ -73,12 +82,22 @@ class Input {
7382 std::vector<std::pair<int, int>> selecting_lines_;
7483 std::vector<std::pair<int, int>> clause_lines_;
7584 std::vector<std::pair<int, int>> selecting_clause_lines_;
85+ std::pair<int, int> selecting_coursorpoint_;
86+ bool drag_flag_;
7687
7788 CallbackFunc on_enter_;
7889 tstring message_;
7990
8091 bool reverse_color_;
8192 int blink_count_;
93+ bool rightmenu_show_;
94+ //std::pair<int, int> mouse_pos_;
95+
96+ UIList right_click_list_;
97+
98+ ConfigManagerPtr config_manager_;
99+
100+ int click_cancel_count_;
82101
83102 private:
84103 const static size_t TEXT_BUFFER_SIZE;
--- a/client/ui/UIBase.hpp
+++ b/client/ui/UIBase.hpp
@@ -137,7 +137,7 @@ Handle<Value> Construct(const Arguments& args) {
137137 UIBasePtr* instance = new UIBasePtr(new T());
138138 Local<v8::Object> thisObject = args.This();
139139 assert(thisObject->InternalFieldCount() > 0);
140- thisObject->SetInternalField(0, External::New(instance));
140+ thisObject->SetInternalField(0, External::New(instance));
141141 Persistent<v8::Object> holder = Persistent<v8::Object>::New(thisObject);
142142 holder.MakeWeak(instance, Destruct);
143143 return thisObject;
--- a/client/ui/UICustom.cpp
+++ b/client/ui/UICustom.cpp
@@ -23,6 +23,11 @@ UICustom::UICustom()
2323
2424 UICustom::~UICustom()
2525 {
26+ if( !graphic_handles_.empty() ){
27+ BOOST_FOREACH(auto handle,graphic_handles_){
28+ DeleteGraph(handle);
29+ }
30+ }
2631 }
2732
2833 Handle<Value> UICustom::Property_processinput(Local<String> property, const AccessorInfo &info)
@@ -98,6 +103,25 @@ void UICustom::DefineInstanceTemplate(Handle<ObjectTemplate>* object)
98103
99104 SetFunction(object, "DrawLine", Function_DrawLine);
100105 SetFunction(object, "DrawBox", Function_DrawBox);
106+ SetFunction(object, "DrawEdgeBox", Function_DrawEdgeBox);
107+ SetFunction(object, "DrawCircle", Function_DrawCircle);
108+ SetFunction(object, "DrawOval", Function_DrawOval);
109+ SetFunction(object, "DrawTriangle", Function_DrawTriangle);
110+ SetFunction(object, "DrawQuadrangle", Function_DrawQuadrangle);
111+ SetFunction(object, "DrawPixel", Function_DrawPixel);
112+ SetFunction(object, "Paint", Function_DrawLine);
113+ SetFunction(object, "DrawPixelSet", Function_DrawBox);
114+ SetFunction(object, "DrawLineSet", Function_DrawEdgeBox);
115+ SetFunction(object, "DrawPixel3D", Function_DrawCircle);
116+ SetFunction(object, "DrawCube", Function_DrawOval);
117+ SetFunction(object, "DrawSphere", Function_DrawTriangle);
118+ SetFunction(object, "DrawCapsule3D", Function_DrawQuadrangle);
119+ SetFunction(object, "DrawCone3D", Function_DrawPixel);
120+
121+ SetFunction(object, "LoadGraph", Function_LoadGraph);
122+ SetFunction(object, "DeleteGraph", Function_DeleteGraph);
123+
124+ SetFunction(object, "DrawText", Function_DrawText);
101125 }
102126
103127 void UICustom::ProcessInput(InputManager* input)
--- a/client/ui/UILabel.cpp
+++ b/client/ui/UILabel.cpp
@@ -22,8 +22,7 @@
2222 const int UILabel::BASE_BLOCK_SIZE = 12;
2323
2424 UILabel::UILabel() :
25- font_handle_(ResourceManager::default_font_handle()),
26- clickchancel_count_(-1)
25+ font_handle_(ResourceManager::default_font_handle())
2726 {
2827 }
2928
@@ -192,12 +191,9 @@ void UILabel::ProcessInput(InputManager* input)
192191 on_click_.As<Function>()->CallAsFunction(Context::GetCurrent()->Global(), 0, nullptr);
193192 }else if(!on_click_function_._Empty()) {
194193 on_click_function_(this);
194+ parent_c_->set_visible(false);
195195 input->CancelMouseLeft();
196- clickchancel_count_ = 8;
197196 }
198- }else if(clickchancel_count_ >= 0 ){
199- input->CancelMouseLeft();
200- --clickchancel_count_;
201197 }else if(hover && !hover_flag_){
202198 if(!on_hover_function_._Empty()) {
203199 on_hover_function_(this);
@@ -255,7 +251,6 @@ void UILabel::UpdatePosition()
255251
256252 for (auto it = char_width_list_.begin(); it != char_width_list_.end(); ++it) {
257253 if ( text_[text_cursor] == _T('\n')) {
258- line_width = 0;
259254 line_num++;
260255 substr_list_.push_back(text_cursor);
261256 substr_list_.push_back(text_cursor + 1);
--- a/client/ui/UILabel.hpp
+++ b/client/ui/UILabel.hpp
@@ -46,8 +46,6 @@ class UILabel : public UIBase {
4646 std::vector<int> char_width_list_;
4747 int font_handle_;
4848
49- int clickchancel_count_;
50-
5149 Color textcolor_, bgcolor_;
5250
5351 private: