Style fixes in a couple functions -- need to fix the entire app, but not right now

Dropping multiple files in the terminal now prints all files' paths instead of just one


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13504 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2005-07-06 17:59:53 +00:00
parent fa65b351ea
commit 94935cfc3c
+86 -74
View File
@@ -1815,63 +1815,76 @@ TermView::FrameResized (float width, float height)
void void
TermView::MessageReceived(BMessage *msg) TermView::MessageReceived(BMessage *msg)
{ {
entry_ref ref; entry_ref ref;
char *ctrl_l = " "; char *ctrl_l = " ";
switch(msg->what){ switch(msg->what){
case B_SIMPLE_DATA: case B_SIMPLE_DATA:
if (msg->FindRef("refs", &ref) == B_OK ){ {
this->DoFileDrop(ref); int32 i=0;
} else { if(msg->FindRef("refs", i++, &ref) == B_OK)
BView::MessageReceived(msg); {
} this->DoFileDrop(ref);
break;
while(msg->FindRef("refs", i++, &ref) == B_OK)
case B_MIME_DATA: this->DoFileDrop(ref);
char *text; }
int32 num_bytes; else
status_t sts; {
BView::MessageReceived(msg);
if (msg->WasDropped()){ }
sts = msg->FindData ((const char *)"text/plain", break;
(type_code)B_MIME_TYPE, }
(const void **)&text, case B_MIME_DATA:
&num_bytes); {
char *text;
if (sts != B_OK) break; int32 num_bytes;
status_t sts;
/* Clipboard text doesn't attached EOF? */
text[num_bytes] = '\0'; if (msg->WasDropped())
WritePTY ((uchar *)text, num_bytes); {
sts = msg->FindData ((const char *)"text/plain",
} (type_code)B_MIME_TYPE,
break; (const void **)&text, &num_bytes);
if (sts != B_OK)
break;
case B_COPY:
this->DoCopy(); // Clipboard text doesn't attached EOF?
break; text[num_bytes] = '\0';
WritePTY ((uchar *)text, num_bytes);
case B_PASTE: }
int32 code; break;
if (msg->FindInt32 ("index", &code) == B_OK) }
this->DoPaste(); case B_COPY:
break; {
this->DoCopy();
case B_SELECT_ALL: break;
this->DoSelectAll(); }
break; case B_PASTE:
{
case MENU_CLEAR_ALL: int32 code;
this->DoClearAll(); if (msg->FindInt32 ("index", &code) == B_OK)
write (pfd, ctrl_l, 1); this->DoPaste();
break; break;
}
case MSGRUN_CURSOR: case B_SELECT_ALL:
this->BlinkCursor (); {
break; this->DoSelectAll();
break;
}
case MENU_CLEAR_ALL:
{
this->DoClearAll();
write (pfd, ctrl_l, 1);
break;
}
case MSGRUN_CURSOR:
{
this->BlinkCursor();
break;
}
// case B_INPUT_METHOD_EVENT: // case B_INPUT_METHOD_EVENT:
// { // {
// int32 op; // int32 op;
@@ -1894,11 +1907,12 @@ TermView::MessageReceived(BMessage *msg)
// break; // break;
// } // }
// } // }
default:
default: {
BView::MessageReceived(msg); BView::MessageReceived(msg);
break; break;
} }
}
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// DoFileDrop // DoFileDrop
@@ -1907,17 +1921,16 @@ TermView::MessageReceived(BMessage *msg)
void void
TermView::DoFileDrop(entry_ref &ref) TermView::DoFileDrop(entry_ref &ref)
{ {
char p[B_PATH_NAME_LENGTH * 2 + 1]; BEntry ent(&ref);
BPath path(&ent);
BEntry ent(&ref); BString string(path.Path());
BPath path(&ent);
string.CharacterEscape(" ~`#$&*()\\|[]{};'\"<>?!",'\\');
int num_bytes = SubstMetaChar (path.Path(), p); string+=" ";
WritePTY ((const uchar *)string.String(), string.Length());
WritePTY ((uchar *)p, num_bytes);
return;
return;
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// DoCopy() // DoCopy()
@@ -2073,7 +2086,6 @@ TermView::SubstMetaChar (const char *p, char *q)
void void
TermView::WritePTY (const uchar *text, int num_bytes) TermView::WritePTY (const uchar *text, int num_bytes)
{ {
if (gNowCoding != M_UTF8) { if (gNowCoding != M_UTF8) {
uchar *dstbuf = (uchar *)malloc (num_bytes * 3); uchar *dstbuf = (uchar *)malloc (num_bytes * 3);
num_bytes = fCodeConv->ConvertFromInternal(text, dstbuf, gNowCoding); num_bytes = fCodeConv->ConvertFromInternal(text, dstbuf, gNowCoding);