Opened 17 years ago

Closed 11 years ago

#968 closed enhancement (fixed)

create a GUI resource editor

Reported by: wkornewald Owned by: mmadia
Priority: low Milestone: Unscheduled
Component: Applications Version: R1/pre-alpha1
Keywords: Cc: darkwyrm, stashaiku@…, ismd
Blocked By: Blocking:
Platform: All

Description

We need a resource editor like QuickRes, for example.

Attachments (2)

resourceedit-part1-6.patch (51.8 KB ) - added by TriEdgeAI 11 years ago.
resourceedit-part2-1.patch (73.6 KB ) - added by TriEdgeAI 11 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 by wkornewald, 17 years ago

Cc: darkwyrm added

Darkwyrm is probably interested in this task, too.

comment:2 by axeld, 17 years ago

Milestone: R1Unscheduled

comment:3 by axeld, 17 years ago

Owner: axeld removed

DiskProbe already has a built-in attribute editor with type specific editors, too - maybe one can join that somehow into one app, a shared library, or add-ons.

comment:4 by stashaiku, 13 years ago

Cc: stashaiku@… added

comment:5 by mmadia, 13 years ago

browser:haiku/trunk/src/apps/resedit is a start of program, similar to QuickRes

comment:6 by ismd, 12 years ago

Cc: ismd added

by TriEdgeAI, 11 years ago

Attachment: resourceedit-part1-6.patch added

by TriEdgeAI, 11 years ago

Attachment: resourceedit-part2-1.patch added

comment:7 by TriEdgeAI, 11 years ago

Google Code-In Task PART I


[Revision 1] [2012-12-29]

  • Made the basic GUI of the application.
  • Created icon by compositing and modifying Haiku icons.
  • Reused toolbox icons from BurnItNow task.
  • Implemented basic adding/ordering/removing of resources.
  • Made modifications to BColumnListView.
  • Fixed a small bug in BColumnListView which caused added rows to appear in the middle, instead of at the end.
  • Implemented basic saving of .rdef files.
  • Added dialogs.
  • Implemented multi-window functionality like Pe, StyledEdit, etc.
  • Application is unfinished. Since task is multi-part, marked as "Complete" due to expiration of time.

[Revision 2] [2012-12-29]

  • Replaced sprintf() call with BString::operator<<
  • Added icon file to patch.
  • Removed BeScreenCapture from Jamfile. Wtf?!
  • Granted my Christmas wish and added BMenu::FindMarkedIndex()

[Revision 3] [2012-12-30]

  • Commented out unfinished .rdef loading support.
  • Added .rsrc load/save support.
  • Fixed gcc4 compile issues.
  • Added toString() functionality.
  • Fixed save dialog no-select bug.
  • Fixed load dialog no-rewind bug.
  • Uploaded binaries (libbe.so and ResourceEdit) for easier testing.

[Revision 4] [2013-01-02]

  • Removed About window. I agree, it would be better off without them in system apps.
  • Fixed code-style issues.
  • Fixed class ImageButton to properly draw itself in disabled state.
  • Removed RECT_0 macro. :( You'll be forever in my heart.
  • Fixed toolbar view color issues.
  • Replaced 'cout's with PRINT macro from <Debug.h>.
  • Fixed gcc4 compilation issues.

[Revision 5] [2013-01-03]

  • Added Jamfile to patch (had forgotten to do so in previous revision).
  • Fixed a subtle bug with all toString methods.
  • Improved SwapRows method (source code provided by Jessica Hamilton as modification to my original code).

[Revision 6] [2013-01-03]

  • Made use of B_FILE_NAME_LENGTH.
  • Ran code through checkstyle.py and cleaned issues.
  • Cleaned whitespace errors and checked with git apply.

comment:8 by TriEdgeAI, 11 years ago

Google Code-In Task PART II


[Revision 1] [2013-01-14]

  • Implemented undo context class (maybe this can be reused as BUndoContext in some kit later on?) and mapped Undo/Redo functionality to it.
  • Implemented editing of resource info.
  • Added a settings window with save/load functionality.
  • Added a statistics view which shows resource count and data size.
  • Added a dialog to ask the user if he wants to save before closing when unsaved changes are present.
  • Implemented extensible editing of resource data (not full support for all types yet).
  • Implemented partial support for saving and loading .rdef files.
  • Commented out .rsrc support as some missing parts of parsing .rdef prevent us from generating a healthy .rsrc yet.

comment:9 by TriEdgeAI, 11 years ago

[TODO]

  • Copy/Paste functionality of ResourceRows.
  • Tab view with three tabs about Resources, Types and Enums.
  • Support for editing custom types. These can pretty much use ResourceRow*, too.
  • Support for editing enums.
  • Finish parsing support for .rdef files (arrays, type-recognition, types, enums, etc..)
  • Finish output support for .rdef files.
  • Provide more settings. This is done by adding views in the settings dir and mapping them in the SettingsWindow class. Actual setting data is stored in SettingsFile class.
  • Add support for child resource rows (arrays, messages, custom types, etc). The code is already prepared for such an addition I believe.
  • Provide more edits for editing different types of resource data. This is done by adding self-attaching views to the edits dir. Good edits would be ColorEdit, NumericEdit<>, StringEdit, NoEdit, etc. Edits are registered to specific resource types in DefaultTypes.h. Resource types like images or icons should be handled by external programs like Icon-O-Matic or WonderBrush instead of having ResourceEdit provide it's own means.
  • Add validation to editing resources. Resource info validity should be checked in EditWindow class, resource data validity should be checked in the respective -Edit class.
  • Merge from functionality (Just like normal load, except you don't clean the list beforehand).
  • Help documents and menu.
  • Drag and drop functionality to add files to the .rdef with option to choose hexdump or import mode.
  • Separate ResourceRow's actual data from preview data. For example if the data is "true" for a boolean resource, one could display "✔ TRUE" instead. Colors can be displayed with background color and inverted color for the text and so on.
  • Allow for thumbnails to be displayed for image resources.
  • Exporting/importing to .rsrc (could either be done through rc, which would be an easier but unsafer way, and through BResources from the Haiku API).
  • Allow resource IDs to use enums.

All I can think of right now. Probably a lot more. I've left TODO comments throughout the code here and there which should assist further by guiding people where to implement things.

comment:10 by mmadia, 11 years ago

Anyone willing and able to comment if these patches are OK to commit?

comment:11 by mmadia, 11 years ago

patch: 01

comment:12 by leavengood, 11 years ago

I think the patches look pretty good and can be committed.

There are some things I would change (such as moving the resource file loading and saving out of MainWindow!!!), but there is no reason to postpone adding the code now. Changes can be made after the patches are committed.

I still need to update my Haiku development setup since it has been a while, so I probably won't get a chance to commit this until later this week. I would not mind if someone else did it.

comment:13 by mmadia, 11 years ago

Applied these patches locally (with minor tweaks to get them to apply). It compiles fine with gcc2, but gcc4 gives this error:

C++ /generated/x86gcc4/objects/haiku/x86/release/apps/resourceedit/SettingsFile.o 
/use-the-source/haiku/src/apps/resourceedit/MainWindow.cpp: In member function 'void MainWindow::_Load()':
/use-the-source/haiku/src/apps/resourceedit/MainWindow.cpp:762:39: error: array subscript has type 'char' [-Werror=char-subscripts]
/use-the-source/haiku/src/apps/resourceedit/MainWindow.cpp:763:29: error: array subscript has type 'char' [-Werror=char-subscripts]
cc1plus: all warnings being treated as errors

/boot/develop/abi/x86/gcc4/tools/current/bin/gcc -c "/use-the-source/haiku/src/apps/resourceedit/MainWindow.cpp" -O2 -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -Wno-multichar -pipe -fno-strict-aliasing -nostdinc -Wno-deprecated -march=pentium -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 -Werror -Wno-error=uninitialized -Wno-unused-but-set-variable -D__HAIKU__ -DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -D__INTEL__ -DARCH_x86 -DBOOT_ARCHIVE_IMAGE_OFFSET=300 -DB_USE_BUILTIN_ATOMIC_FUNCTIONS -DHAIKU_INCLUDE_PATENTED_CODE=0 -DHAIKU_TARGET_PLATFORM_HAIKU -iquote /use-the-source/haiku/build/user_config_headers -iquote /use-the-source/haiku/build/config_headers -iquote /use-the-source/haiku/src/apps/resourceedit -iquote /generated/x86gcc4/objects/common/apps/resourceedit -iquote /generated/x86gcc4/objects/haiku_host/x86/common/apps/resourceedit -iquote /generated/x86gcc4/objects/haiku/x86/common/apps/resourceedit -iquote /use-the-source/haiku/src/apps/resourceedit/edits -iquote /use-the-source/haiku/src/apps/resourceedit/interface -iquote /use-the-source/haiku/src/apps/resourceedit/settings -iquote /use-the-source/haiku/src/apps/resourceedit/support -I /use-the-source/haiku/headers/private/interface -I /use-the-source/haiku/headers/private/shared -I /boot/develop/abi/x86/gcc4/tools/gcc-4.6.3-haiku-121101/lib/gcc/i586-pc-haiku/4.6.3/../../../../include/c++/4.6.3 -I /boot/develop/abi/x86/gcc4/tools/gcc-4.6.3-haiku-121101/lib/gcc/i586-pc-haiku/4.6.3/../../../../include/c++/4.6.3/i586-pc-haiku -I /boot/develop/abi/x86/gcc4/tools/gcc-4.6.3-haiku-121101/lib/gcc/i586-pc-haiku/4.6.3/../../../../include/c++/4.6.3/backward -I /boot/develop/abi/x86/gcc4/tools/gcc-4.6.3-haiku-121101/lib/gcc/i586-pc-haiku/4.6.3/../../../../include/c++/4.6.3/ext -I /boot/develop/abi/x86/gcc4/tools/gcc-4.6.3-haiku-121101/lib/gcc/i586-pc-haiku/4.6.3/include -I /boot/develop/abi/x86/gcc4/tools/gcc-4.6.3-haiku-121101/lib/gcc/i586-pc-haiku/4.6.3/include-fixed -I /use-the-source/haiku/headers -I /use-the-source/haiku/headers/posix -I /use-the-source/haiku/headers/glibc -I /use-the-source/haiku/headers/os -I /use-the-source/haiku/headers/os/add-ons -I /use-the-source/haiku/headers/os/add-ons/file_system -I /use-the-source/haiku/headers/os/add-ons/graphics -I /use-the-source/haiku/headers/os/add-ons/input_server -I /use-the-source/haiku/headers/os/add-ons/registrar -I /use-the-source/haiku/headers/os/add-ons/screen_saver -I /use-the-source/haiku/headers/os/add-ons/tracker -I /use-the-source/haiku/headers/os/app -I /use-the-source/haiku/headers/os/device -I /use-the-source/haiku/headers/os/drivers -I /use-the-source/haiku/headers/os/game -I /use-the-source/haiku/headers/os/interface -I /use-the-source/haiku/headers/os/kernel -I /use-the-source/haiku/headers/os/locale -I /use-the-source/haiku/headers/os/media -I /use-the-source/haiku/headers/os/mail -I /use-the-source/haiku/headers/os/midi -I /use-the-source/haiku/headers/os/midi2 -I /use-the-source/haiku/headers/os/net -I /use-the-source/haiku/headers/os/opengl -I /use-the-source/haiku/headers/os/storage -I /use-the-source/haiku/headers/os/support -I /use-the-source/haiku/headers/os/translation -I /use-the-source/haiku/headers/private/. -o "/generated/x86gcc4/objects/haiku/x86/release/apps/resourceedit/MainWindow.o" ;

...failed C++ /generated/x86gcc4/objects/haiku/x86/release/apps/resourceedit/MainWindow.o ...

comment:14 by leavengood, 11 years ago

I think it is really just a warning being treated as an error on these two lines:

if (in[i] == '\\' && escChars[in[i]] != ~(char)0) { 
    buffer += escChars[in[i]];

But it could probably be fixed by casting the in[i] to an int before using it as an array index in escChars:

escChars[(int)in[i]]

comment:15 by mmadia, 11 years ago

Owner: set to mmadia
Status: newin-progress

Will push this in a few minutes.

comment:16 by mmadia, 11 years ago

Applied in hrev45326. Thanks TriEdgeAI for improving this. Looking forward to being able to apply more patches from you in the future!

comment:17 by mmadia, 11 years ago

Resolution: fixed
Status: in-progressclosed

*sighs* .... closing the ticket would be good.

Note: See TracTickets for help on using tickets.