PPM translator: clang-format
Change-Id: I290f9b369af37d919308759b83c42122f7f309bc Reviewed-on: https://review.haiku-os.org/c/902 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
4bf8cf7a1b
commit
72c5a125f1
@@ -22,58 +22,61 @@
|
||||
BPoint get_window_origin();
|
||||
void set_window_origin(BPoint pt);
|
||||
|
||||
class PPMWindow :
|
||||
public BWindow
|
||||
class PPMWindow : public BWindow
|
||||
{
|
||||
public:
|
||||
PPMWindow(BRect area) :
|
||||
BWindow(area, B_TRANSLATE("PPM Settings"), B_TITLED_WINDOW,
|
||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
|
||||
{
|
||||
BLayoutBuilder::Group<>(this, B_HORIZONTAL);
|
||||
}
|
||||
PPMWindow(BRect area)
|
||||
: BWindow(area, B_TRANSLATE("PPM Settings"), B_TITLED_WINDOW,
|
||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
|
||||
{
|
||||
BLayoutBuilder::Group<>(this, B_HORIZONTAL);
|
||||
}
|
||||
~PPMWindow()
|
||||
{
|
||||
BPoint pt(0,0);
|
||||
ConvertToScreen(&pt);
|
||||
set_window_origin(pt);
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
{
|
||||
BPoint pt(0, 0);
|
||||
ConvertToScreen(&pt);
|
||||
set_window_origin(pt);
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
};
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
BApplication app("application/x-vnd.Haiku-PPMTranslator");
|
||||
BView * v = NULL;
|
||||
BView* v = NULL;
|
||||
BRect r(0, 0, 1, 1);
|
||||
if (MakeConfig(NULL, &v, &r)) {
|
||||
BAlert * err = new BAlert("Error",
|
||||
B_TRANSLATE("Something is wrong with the PPMTranslator!"),
|
||||
BAlert* err = new BAlert("Error",
|
||||
B_TRANSLATE("Something is wrong with the PPMTranslator!"),
|
||||
B_TRANSLATE("OK"));
|
||||
err->SetFlags(err->Flags() | B_CLOSE_ON_ESCAPE);
|
||||
err->Go();
|
||||
return 1;
|
||||
}
|
||||
PPMWindow *w = new PPMWindow(r);
|
||||
PPMWindow* w = new PPMWindow(r);
|
||||
v->ResizeTo(r.Width(), r.Height());
|
||||
w->AddChild(v);
|
||||
BPoint o = get_window_origin();
|
||||
{
|
||||
BScreen scrn;
|
||||
BRect f = scrn.Frame();
|
||||
f.InsetBy(10,23);
|
||||
f.InsetBy(10, 23);
|
||||
/* if not in a good place, start where the cursor is */
|
||||
if (!f.Contains(o)) {
|
||||
uint32 i;
|
||||
v->GetMouse(&o, &i, false);
|
||||
o.x -= r.Width()/2;
|
||||
o.y -= r.Height()/2;
|
||||
o.x -= r.Width() / 2;
|
||||
o.y -= r.Height() / 2;
|
||||
/* clamp location to screen */
|
||||
if (o.x < f.left) o.x = f.left;
|
||||
if (o.y < f.top) o.y = f.top;
|
||||
if (o.x > f.right) o.x = f.right;
|
||||
if (o.y > f.bottom) o.y = f.bottom;
|
||||
if (o.x < f.left)
|
||||
o.x = f.left;
|
||||
if (o.y < f.top)
|
||||
o.y = f.top;
|
||||
if (o.x > f.right)
|
||||
o.x = f.right;
|
||||
if (o.y > f.bottom)
|
||||
o.y = f.bottom;
|
||||
}
|
||||
}
|
||||
w->MoveTo(o);
|
||||
@@ -81,4 +84,3 @@ main()
|
||||
app.Run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -12,18 +12,18 @@
|
||||
/* with rowbytes amount of pixel data into some other color space in */
|
||||
/* out_data, with enough memory assumed to be in out_data for the */
|
||||
/* converted data. */
|
||||
status_t convert_space(color_space in_space, color_space out_space,
|
||||
unsigned char * in_data, int rowbytes, unsigned char * out_data);
|
||||
status_t convert_space(color_space in_space, color_space out_space,
|
||||
unsigned char* in_data, int rowbytes, unsigned char* out_data);
|
||||
|
||||
/* This function expands rowbytes amount of data from in_data into */
|
||||
/* RGBA32 data in out_buf, which must be big enough. */
|
||||
int expand_data(color_space from_space, unsigned char * in_data,
|
||||
int rowbytes, unsigned char * out_buf);
|
||||
int expand_data(color_space from_space, unsigned char* in_data, int rowbytes,
|
||||
unsigned char* out_buf);
|
||||
|
||||
/* This function converts num_bytes bytes of RGBA32 data into some new */
|
||||
/* color space in out_buf, where out_buf must be big enough. */
|
||||
int collapse_data(unsigned char * in_buf, int num_bytes,
|
||||
color_space out_space, unsigned char * out_buf);
|
||||
int collapse_data(unsigned char* in_buf, int num_bytes, color_space out_space,
|
||||
unsigned char* out_buf);
|
||||
|
||||
/* Given a specific number of pixels in width in the color space space */
|
||||
/* this function calculates what the row_bytes should be. */
|
||||
|
||||
Reference in New Issue
Block a user