Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of a bar displaying the name of the image being displayed #3

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

AlexCreamer
Copy link

No description provided.

Copy link
Owner

@pedrocr pedrocr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the smaller stuff I've pointed out as we've discussed on IRC it would make sense to show the image width and height as well at least.

src/main.rs Outdated
.center_justify()
.line_spacing(10.0)
.set(ids.lefttext, ui);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace here is misaligned

src/main.rs Outdated

if let Some(ref f) = file {
let file_name = Path::new(f).file_name().unwrap();
widget::Text::new(file_name.to_str().unwrap())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These unwrap()s need to be handled

src/main.rs Outdated
(ids.imgcanvas, widget::Canvas::new().color(color::CHARCOAL).border(0.0)),
(ids.leftarea, widget::Canvas::new().color(color::CHARCOAL).border(0.0).flow_down(&[
(ids.imgcanvas, widget::Canvas::new().color(color::GREY).border(0.0)),
(ids.footer, widget::Canvas::new().color(color::CHARCOAL).length(75.0).border(0.0)),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The footer is probably too tall for just the text. It should be sized to hold 1.5 font heights or something like that.

@@ -41,7 +42,7 @@ fn main() {
let mut renderer = conrod::backend::glium::Renderer::new(&display).unwrap();

// The `WidgetId` for our background and `Image` widgets.
widget_ids!(struct Ids { background, imgcanvas, dragcanvas, setcanvas, settop, setcont, raw_image, chimper, filenav });
widget_ids!(struct Ids { background, imgcanvas, dragcanvas, leftarea, lefttext, footer,setcanvas, settop, setcont, raw_image, chimper, filenav });
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lefttext doesn't exist

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lefttext is being used on line 188

@@ -155,6 +159,20 @@ fn main() {
.set(ids.chimper, ui);
}

const PAD: Scalar = 20.0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just copied from the example and has no meaning in this program. A proper variable name should be used instead.

.line_spacing(10.0)
.set(ids.lefttext, ui);
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably excess white space.

Copy link
Owner

@pedrocr pedrocr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still very far from being finished, sorry.

@@ -81,4 +81,33 @@ impl ImageCache {
ui.needs_update();
});
}
}

pub fn get_image_dimensions<'a>(&'a self, path: String, size: usize) -> Option<(usize,usize)>{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing the image all over again just to get the dimensions is just broken.

},
};
let imgwidth = decoded.width;
let imgheight = decoded.height;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't return the image dimensions, it will return the decoded dimensions that in the case of raws has been downsized.

(ids.imgcanvas, widget::Canvas::new().color(color::CHARCOAL).border(0.0)),
(ids.leftarea, widget::Canvas::new().color(color::CHARCOAL).border(0.0).flow_down(&[
(ids.imgcanvas, widget::Canvas::new().color(color::GREY).border(0.0)),
(ids.footer, widget::Canvas::new().color(color::CHARCOAL).length(60.0).border(0.0)),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to be sized to the font size.

let height_usize = dimensions.1;

let width = &width_usize.to_string();
let height = &height_usize.to_string();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't needed at all. format! can handle the usize directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants