diff --git a/src/cache.rs b/src/cache.rs index ca38fa2..84a80bb 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -1,15 +1,11 @@ -use cairo::{Context, Format, ImageSurface, ImageSurfaceData, ImageSurfaceDataOwned}; -use glib::{clone, Bytes}; -use gtk::{gdk::Texture, Picture}; -use pdfium_render::{pdfium, prelude::*}; use poppler::{Document, Page}; use std::{ collections::BTreeMap, path::{Path, PathBuf}, - sync::{Arc, Mutex}, + sync::Arc, }; -use async_channel::{Receiver, Sender}; +use async_channel::Sender; type PageNumber = usize; pub type MyPageType = Page; diff --git a/src/draw.rs b/src/draw.rs index 51a6963..d4109f2 100644 --- a/src/draw.rs +++ b/src/draw.rs @@ -1,22 +1,7 @@ -use std::{ - cell::RefCell, collections::BTreeMap, path::Path, rc::Rc, sync::Arc, thread, time::Duration, -}; +use cairo::Context; -use async_channel::Sender; -use cairo::{Context, Format, ImageSurface, ImageSurfaceData, ImageSurfaceDataOwned}; -use gtk::{ - gdk::Paintable, gio, glib, prelude::*, subclass::drawing_area, Application, ApplicationWindow, - Box, Button, DrawingArea, FileChooserAction, FileChooserDialog, HeaderBar, Label, Orientation, - Picture, ResponseType, -}; -use poppler::{Document, Page}; - -use crate::{ - cache::{self, CacheCommand, MyPageType, PageCache}, - ui::Ui, -}; -use glib::clone; -use gtk::prelude::*; +use crate::ui::Ui; +use gtk::{prelude::*, DrawingArea}; pub fn draw(ui: &mut Ui, area: &DrawingArea, context: &Context) { println!("Draw"); diff --git a/src/ui.rs b/src/ui.rs index a833fd9..a01921f 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,18 +1,14 @@ -use std::{ - cell::RefCell, collections::BTreeMap, path::Path, rc::Rc, sync::Arc, thread, time::Duration, -}; +use std::{cell::RefCell, path::Path, rc::Rc, sync::Arc}; use async_channel::Sender; -use cairo::{Context, Format, ImageSurface, ImageSurfaceData, ImageSurfaceDataOwned}; +use cairo::{Context, Format, ImageSurface}; use gtk::{ - gdk::Paintable, gio, glib, prelude::*, subclass::drawing_area, Application, ApplicationWindow, - Box, Button, DrawingArea, FileChooserAction, FileChooserDialog, HeaderBar, Label, Orientation, - Picture, ResponseType, + glib, Application, ApplicationWindow, Box, Button, DrawingArea, FileChooserAction, + FileChooserDialog, HeaderBar, Label, Orientation, ResponseType, }; -use poppler::{Document, Page}; use crate::{ - cache::{self, CacheCommand, MyPageType, PageCache}, + cache::{self, CacheCommand, MyPageType}, draw, }; use glib::clone; @@ -24,7 +20,6 @@ pub struct Ui { header_bar: gtk::HeaderBar, page_indicator: gtk::Label, drawing_area: gtk::DrawingArea, - picture: Picture, pub drawing_context: cairo::Context, pub document_canvas: Option, } @@ -136,7 +131,7 @@ fn update_page_status(ui: &Ui) { ui.page_indicator.set_label(page_status.as_str()); } -fn process_right_click(ui: &mut Ui, x: f64, y: f64) { +fn process_right_click(ui: &mut Ui, _x: f64, _y: f64) { if ui.document_canvas.is_none() { return; } @@ -200,12 +195,6 @@ impl Ui { .hexpand(true) .vexpand(true) .build(), - picture: Picture::builder() - .width_request(400) - .height_request(300) - .hexpand(true) - .vexpand(true) - .build(), drawing_context: create_drawing_context(), document_canvas: None, };