| 606 | } |
| 607 | |
| 608 | void AddTabWithFile(const char* filename, HINSTANCE hInstance) |
| 609 | { |
| 610 | char buf[1024]; |
| 611 | char *file = NULL; |
| 612 | GetFullPathName(filename, 1024, buf, &file); |
| 613 | |
| 614 | FILE *startText = fopen(buf, "rb"); |
| 615 | char *fileContent = NULL; |
| 616 | if(!startText) |
| 617 | return; |
| 618 | |
| 619 | richEdits.push_back(CreateWindow("NULLCTEXT", NULL, WS_CHILD | WS_BORDER, 5, 25, areaWidth, areaHeight, hWnd, NULL, hInstance, NULL)); |
| 620 | TabbedFiles::AddTab(hTabs, buf, richEdits.back()); |
| 621 | ShowWindow(richEdits.back(), SW_HIDE); |
| 622 | |
| 623 | fseek(startText, 0, SEEK_END); |
| 624 | unsigned int textSize = ftell(startText); |
| 625 | fseek(startText, 0, SEEK_SET); |
| 626 | fileContent = new char[textSize+1]; |
| 627 | fread(fileContent, 1, textSize, startText); |
| 628 | fileContent[textSize] = 0; |
| 629 | fclose(startText); |
| 630 | |
| 631 | RichTextarea::SetAreaText(richEdits.back(), fileContent ? fileContent : ""); |
| 632 | delete[] fileContent; |
| 633 | |
| 634 | RichTextarea::BeginStyleUpdate(richEdits.back()); |
| 635 | colorer->ColorText(richEdits.back(), (char*)RichTextarea::GetAreaText(richEdits.back()), RichTextarea::SetStyleToSelection); |
| 636 | RichTextarea::EndStyleUpdate(richEdits.back()); |
| 637 | RichTextarea::UpdateArea(richEdits.back()); |
| 638 | RichTextarea::ResetUpdate(richEdits.back()); |
| 639 | } |
| 640 | |
| 641 | bool SaveFileFromTab(const char *file, const char *data, HWND editWnd) |
| 642 | { |
no test coverage detected